7 ms·
Well of course component state is what you reach for first, which is why it is the first four sections of those docs about state management I linked: https://r
by __jonas 2y ago
Well of course component state is what you reach for first, which is why it is the first four sections of those docs about state management I linked:
https://react.dev/learn/managing-state https://react.dev/learn/managing-state
I was linking this later section about extracting state logic into a reducer, because you suggested that you would need "something for state management", I assumed you were talking about something like redux.
But of course you can get pretty far with a single useState and prop drilling as well. Not sure how it supports your point that 'plain react is useless', it sounds like you are arguing against yourself with that comment?
- nsonha 2y agoNo it's a different point, in this, I just wanna express how ridiculous the official React docs can be sometimes. The Redux "pattern" you speak of, does nothing to manage state better than useState(). So I'm not sure why that API even exists, or why you think that is a good response to "need something to manage states". Let's go back to that, managing state would be for example error and pending state for every async action. In react, that basic, repetitive task is a whole celebration if you just do plain. Try do do form with per-field back-end validation feedback and see how much boilerplate you need for that.
- __jonas 2y agoAlright sure, I guess I just don't understand what it is "you need" for state management then, but I don't want to get caught up in this too much, you've made your point. I 100% agree that React is super boilerplate heavy, a lot of things are indeed 'a whole celebration', I personally choose something like Svelte over React if I have the choice, because I don't enjoy that either. All I'm saying is that plain React is not useless! It's completely fine. I don't mind working with it, it makes a tradeoff of being more ceremony but perhaps less magic and I think the tradeoff is okay.