PLS use more drawings like in this video. It makes it much easier to understand. Awesome channel
Zustand is so good that you should not bother with reducer and context hooks other than to feel how painful it is to use them, so that you would be able to appreciate zustand even more.
Thank you for not saying there is "state" in server components. It tripped up a lot of people.
Video title is click bait. Please correct the title. Title should be " State Managers Are Making Your Code Worse In Small simple React project" Video starts at 10:57
I love how Svelte solves - very simple and intuitive and it's baked in the language.
What app is being used to draw/illustrate?
No, please don't use Context with Reducer for state management. It is not optimal (re-rendering due to the lack of selectors), much boilerplait needed especially in TS. Jotai is much better option if you need to manage global client state.
My second week into React development, learning RTK for state management saved my project and probably my career. Even after revoewing Zustand, i cannot see anything as scalable or clean as Redux Toolkit.
Finally someoone who understands what I have always said. Nice video and great explanation. 90% of the time you do not need state management! keep your code clean and if you don't need some fancy library then don't use it. You are only "prop drilling'" if your only going way too deep into your components. Love you Web Dev. GREAT VIDEO!
the thing is if you wait until it gets too complex, have fun refactoring
For enterprise software, where complex state is a necessity, state managers are a blessing. I'm happy with RTK/RTK Query.
What tool are you using to draw these diagrams? It looks like something I need in my dev life STAT. 3:03
React is designed to be flexible, and encourages the use of third-party libraries. So, why discourage us from using a packages like Zustand?
10:02 hmm
I think passing state down the tree is not the main problem a state management library solves. The really nasty side of react is dealing with a state that's an object, containing arrays of objects, etc. It becomes very difficult to correctly merge updates to this state to avoid unnecessary re-rendering, or to force re-rendering when needed. This is the most nasty and difficult part or react, which they didn't really solve to this day, and that's why all those libraries were invented and continue being invented - to deal with state updates. State passing can be solved with the context, but state merging is still a big pain and Achilles' heel of the whole react universe. I was spending endless hours trying to figure out unexpected rendering issues every time (which you don't have direct control over as it's all react magic which is the worst part) until tried MobX and it finally all started working together just like I always expected without any weird unexpected side effects.
Redux + saga is still for me the best combination. You've got clear components without any async requests. You send only events, so much clear.
To be honest I feel like we are moving back to PHP world 😢
React Context is a robust and easy-to-use solution for state management. In my experience, it has proven to be highly effective and free of issues. There is considerable debate regarding the use of URLs to store state. It's important to note that search parameters should be used specifically for conducting searches, not for general state storage. While storing state in a database might make sense in some scenarios, it can be impractical for managing UI-related, client-side state. Frequent re-fetching of data from the server can introduce unnecessary complexity and friction. Instead, maintaining state on the client side often leads to a more seamless and efficient user experience.
I'm using Nextjs and i already figure it out that state was no longer needed in my application because i prefer using SSR and page be generated server side to gain performance which is a great thing but when you have client interaction to filters blog for example , i thought there were no other way to deal with states so thank you so much for the URL parameters tips , didn't think about that and i'm gonna apply this idea right away :)
@loO5r