There's a whole thing between global state and local states and that usually comes with doing frontend routing on something that should have been an MPA (and maybe powered by something like liveview). React should have been what it was initially designed for, just a UI library for when you need lots of interaction on a single page. But the whole ecosystem is a mess right now.