Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Classic React. The subject of state comes up and a debate starts as the noobs squint at the screen. Pretty much the whole point of this thread/post. I started a significant project using React and tried for days to figure out how to handle state. After endless debate and conflicting advice online I felt I needed to speak with someone who has built a real world business app to explan how the fuck they pulled it off without pulling out their hair. (Still very curious but spooked enough to avoid sauntering onto a React project to find out.)


Use a networking library like relay, or react-query and 90% of your state management problems go away in most apps.

Your state is on the DB, those libs handle fetching and caching it.

Honorable mention, haven’t used it myself but there is RTK Query too, which is a library like those, but based on Redux, could be easier to debug.


Thats because in the react world its all about state management. Once it clicks that the view is just a function of state then these discussions will make more sense.


This is one of the statements I hear over and over from React devs that while technically true just glosses over the giant iceberg that is state management in React.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: