Member-only story
What Actually Happens When You Open the Same React App in Two Tabs?
Bestte
9 min read5 hours ago
React state, IndexedDB, BroadcastChannel, and the problem of deciding which tab has the latest data.
Press enter or click to view image in full size Photo by Richy Great on Unsplash
I sometimes have the same website open in several tabs. One of them might have been sitting there for hours while I’m working on something else.
And I don’t usually think about what happens between those tabs.
Let’s say you’re editing a document in a React application. You open it in one tab, then open the same document in another tab.
Both tabs display the same information.
You make a change in the first tab and save it.
What happens to the second one?
Does it know something changed? Does React automatically update it?…