Access SessionStorage At ComponentDidMount
I was under the assumption that sessionStorage gets instantiated after a component has been mounted and one can access it through a componentDidMount call. I am using this script t
Solution 1:
It is working as intended.
Session storage works for your current session. When you open a new tab you are creating a new session, that's why the initial data is null.
Use localStorage to persist data within tabs.
I don't know your use case but start with switching out sessionStorage and localStorage.
Save the normal things on sessionStorage
.
Persist on localStorage
Post a Comment for "Access SessionStorage At ComponentDidMount"