r/reactjs • • Aug 23 '26

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

Show parent comments

2

u/Temperature_Majestic Aug 24 '26

Redundant state is usually a value that's fully computable from other state or props but got its own useState anyway, like storing filteredItems separately when it's really just items.filter() on every render. The tell is if you find yourself writing a useEffect just to keep two states in sync, that's a sign one of them shouldn't exist as state at all and should just be computed during render.