r/reactjs • u/allaboutzaid • 1d ago
Discussion Hot take: for most small React projects, useState + lifting state up is enough — I only reached for a state library when props got silly
Been learning React properly over the last few months while working a full-time marketing job and studying BCA, so most of my projects are small — a portfolio site, a couple of client landing pages. Early on I thought I needed Redux for everything because every tutorial mentioned it. In practice, useState and passing props down got me through all of it. The one time I actually felt the pain was a multi-step form where the same data was needed three components deep and I was passing props through components that didn't care about them. That's when I tried Zustand and it clicked. Curious — what was the moment you knew you actually needed a state library, and which one did you pick? Or do you still avoid them?
5
u/anthony-ball 1d ago
Mostly agree. The multi-step form is the classic case, but I'd try a context scoped to just that form first, since that state only lives as long as the wizard does. Where I actually reach for a library is server data: once you're caching, refetching and invalidating, TanStack Query takes over most of what people used to put in Redux, and the client state left over is usually small enough for useState or a tiny Zustand store. Picking the library before you feel the pain mostly just adds plumbing.
4
u/birdynj 1d ago
Why are people taking the time to respond to a low effort, AI generated post?
1
u/No-Humor-3808 6h ago
I'd say don't rush into state management libraries. Start by building things with vanilla JS and no dependencies to really understand the fundamentals (https://www.javascript100.dev/). Then, as your React projects get more complex, try challenges that introduce concepts like reducers, shared state and stores. You'll quickly realise when prop drilling becomes a problem and when a library like Zustand actually makes sense. That's something you can practise with progressively harder challenges at https://www.reactchallenges.com/.
2
u/jax024 1d ago
I reach for form libs right away
2
u/R3PTILIA 1d ago
Context redux and zustand solve different problems. One is for managing shared state across a subtree. The other are for external stores. The use redux everywhere was more like these course guru makers trying to justify their own existence. Dont get me wrong redux is a great idea but its just a tool for specific use cases.
Context: shared state that changes rarely. Bad use of context is the number one cause of perf issues.
Redux: complex state management workflow where you need a clear data flow, observability or other features.
Zustand: external store for data or state. Allows you to control who subscribes to it in a more granular way.
3
u/SatoshiNakamoto_2009 1d ago
bro you can't just say useState + lifting state up is enough
useContext, there is something edd, its just basically knowing your shit, you decide you cant just say oh most small react projects use state and lifting state up is enough....
someone with vast knowledge on refs can really get some nice work on ui, maybe someone knows how to handle and split his code into contexts small solid effective contexts that redux is literally useless
there's no right or wrong no small project needs that or big project needs that, if you know what you doing, you really know and i mean really know....you take a look at a project does not matter what langauge and u say i need this and that, i will this and that...but you seem like someone who is not in control of react
redux has its own use case so it does not matter if no one really using it now or abandon it, whatever suits u whatever fits the job.....react now has this hook useOptimstic and other hooks that its no longer needed for people to use state library
I personally think redux specially the toolkit has one of the most beautiful architecture ever and its so much fun activiating these reducers and just getting deep into them and seeing them perform
so really stop with all this hot take cold take, do whatever the fuck u want, learn keep learning, everything ever created from electricity to chips to html is cool
1
u/FahadAppMaster 21h ago
You're right that useState plus lifting is enough for most small projects — the moment I know I need something more is not really prop depth, it's when I catch myself syncing state by hand. If you have the same value living in two places and a useEffect keeping them in sync, that's two sources of truth waiting to disagree, and that's when a store earns its keep. The multi-step form is the classic example, and your instinct to reach for Zustand there was good — a small external store lets each step subscribe to just the slice it needs, so typing in one field doesn't re-render the whole wizard the way a big Context value would. My rule of thumb: lift state up while it has one clear owner, reach for Context when the state is truly global and changes rarely (theme, auth), and reach for a store when several unrelated components read and write the same state often. And if the state comes from a server, that's a different problem entirely — cache it with a data-fetching library instead of stuffing it into client state.
-13
u/Metalwell 1d ago edited 1d ago
who cares? ai knows and codes better lol. You guys are just coping lol. I bet all of you are just prompting "do this" and go take a coffee and come back and then push to prod lol