[英]How can I render the values of an array in sessionStorage?
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.大家好我正在使用 sessionStorage 来保存我的待办事项应用程序的一些任务,每个任务都有一个动态生成的键,我想将所有值带回我的页面。 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}
/>
)
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.