Hacker News new | past | comments | ask | show | jobs | submit login

I just learned React/Nextjs for a take home coding interview assignment. I used useState a few times. Why would I need redux when there’s useState and useContext?

Other than being overly verbose, I think React is ok after building my website with Sveltekit. There just seems to be way more support for off the shelf react components and 99% of jobs ask for React.




Don't use redux alone, use redux toolkit or mobx which are more simpler and newer. Sure, you don't need them and can be replaced with useState instead.

They shine when you need / can separate the business logic with ui. Think about state management as "backend" for your frontend.

What props they have, whether a function will change which props, etc, are belonging to state management. Heck, even the state management can be done in separate project by different team.

The best thing, in a bigger org / bigger project, you can have 2 state management code. One is mock, for frontend to develop, which has no dependency with servers, and another is the real one, that really call the backend server for real data.




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

Search: