Md Toy Blog

Why avoid passing state around in React?

THIS_IS_A_DUMMY_VAL_FOR_A_MISSING_REF

Passing state around through location seems like an amazing way to avoid querying the server. Plus it prevents from lifting the state and / or using Redux or React's useContext. But still everyone will tell you not to do it…

People are sheeple right? And you should do things even if you are told not not too, unless they give you a valid reason right?

Well, one reason is that when sharing a URL, the target page will not work properly if it's loading content that depends on a certain state (but it is not there, because you load the app without doing all the clicks that generated that state…).