NextJS developers: what do you use for state management? (if anything)
I've only somewhat recently discovered NextJS after developing with React for quite some time. I really love it!
So far, on the small apps that I've build with NextJS so far I haven't really needed any real state management, but now with my current project which is a bit bigger, I think I'm hitting a point where I might need to manage state a bit better.
I used Redux heavily in the past, and wish to avoid touching it ever again if I can help it. I've recently also discovered PullState which is really nice so far.
What do you use?
I have never needed to much complex state management somehow. Never really understood why anyone would. Maybe i'm missing something :D Whats a use case?
@strange_quirks In fairness I think for many cases you probably don't need it. In my case, it's helping me with some client-side reactivity stuff. ie. added an item to a list via API, and as it returns successful, I need something in a different part of the UI to update. You could achieve the same thing in a few ways, but the easiest/cleanest I think is to use something to managing the state of those things 👍🏼
@strange_quirks The main reason you would use it is if you have a complex application with many pieces of state shared by multiple areas. By having a state management solution it means when you update the state then all the places that share the state would be updated instead of them becoming out of sync.
For https://budg.co I’m using react-query for local states (blitzjs behind the scene) and useReducer in a react provider for global states.
unstated-next (https://github.com/jamiebuilds/unstated-next). The tagline is "200 bytes to never think about React state management libraries ever again" and literally I haven't had to think about state management in over a year since I found it.
Please sign in to leave a comment.