Hi everyone I'm using sessionStorage to save some tasks of my todo App, each of these has a dynamically generated key and I would like to bring all the values back to my page. I tried everything and asked many people, can anyone tell me how I can do it?? Below is the example code...
let obj = Object.keys(sessionStorage)
let get_obj = obj.map((el)=> {return el;})
sessionStorage.getItem(get_obj)
After a few days of work, I found the solution... The following must be done:
Object.keys(sessionStorage).map((el,i)=>{
let num = sessionStorage.getItem(el)
return(
<Task
key={i}
value={num}
/>
)
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.