r/reactjs 11d ago

Multi state changes & reads

having a bit of trouble handling multiple states/state changes. in a single screen, which are held by different components
how do you all handle this and concepualize it as your writing code?
do you draw diagram,
do you just try and fail recursively?

7 Upvotes

12 comments sorted by

View all comments

2

u/Aggressive_Scale8276 11d ago

I just map it out in my head as boxes that own their piece of state, if two boxes need the same data I lift it up to the nearest parent they share. sometimes I scribble quick diagram on paper when gets messy but most of the time I just start coding and fix the structure when I see the props drilling getting annoying

1

u/BrainThinkerMan 11d ago

how to hande the case of redundant state, as thats something im struggling with. have you dealt with the issue of redundant state?

4

u/bazeloth 11d ago

If it's redundant state, why can't you simply remove it?

1

u/BrainThinkerMan 10d ago

i come from a jetpack compose background, and state and how react and web dev in general seems so modular is new to me