DEV Community

Discussion on: What are your opinions on local state vs global state in React?

Collapse
 
jtonzing profile image
Josh Tonzing • Edited

Putting everything in Redux will often be too heavy handed, particularly for aspects like visual states (show/hide/expand/style content); however, data values attributes I will put within the global state as for me it is easier to track when, how, and what data is changing to.

I also find the issue of having some data values being handled within local state, and other within global state a nuisance to debug.

Collapse
 
kylessg profile image
Kyle Johnson • Edited

I completely agree with this, I find the idea of putting visual state in a store mental no matter how big the app is.

In my case I use a setup where flux stuff is shared between react and react native so all data is decoupled from platforms which just feels correct to me as it could “live” anywhere, even on the server.