Say, there are two tabs with the same webpage open. On one tab, I make some change in localStorage, then, when I go to the other tab, I'd like to see that change without having to reload the page.
One way that I have thought to do this is by using a setInterval
method, but for my application I don't really need to check for updates every 3-5 seconds so I don't feel this approach is ideal.
I am using React. TLDR: Is there a good way to update data as soon as I open the tab of a previously-loaded webpage?
Side Note For iOS Folks: On iOS, there is a viewDidLoad
method (which from my understanding is similar to componentDidMount
), and there is a viewDidAppear
method (so I am basically, asking for the React/JS version of viewDidAppear
?)
In regards to the possible duplicate question: To me, it seems fairly different, and this question is more React.js focused.