3 ms·
Updates like this are exactly why React sucks. If you're going to add something to the main project, it should be well-designed, clear, and in good taste. Reac
by preommr 2y ago
Updates like this are exactly why React sucks.
If you're going to add something to the main project, it should be well-designed, clear, and in good taste. React won over things like Angular because the latter had poorly designed abstractions. It was supposed to be "just javascript" (which was always more of a vibe being actually true).
Just look at wtf actions are. In their blogpost[0], the old way of doing things is only a few lines more, but is much clearer. The 'useTransition' still has to update the error state - but at least it saves you from typing the pending state!
But of course, you're not supposed to use this directly, you're supposed to use useActionState. And this blog post makes it's usage very clear by just returning null to show something that's supposed to update state. So very clear, and intuitive /s
Stuff like this really should've been in a separate library. It baffles my mind that core behavior like state management is left to external solutions, but then random crap like this makes it into the main project.
[0]https://react.dev/blog/2024/12/05/react-19#actions https://react.dev/blog/2024/12/05/react-19#actions
- foretop_yardarm 2y agoIt would have been a different story if these features had shipped a few years ago but react query is definitely the elephant in the room here.
- wackget 2y ago> the old way of doing things is only a few lines more, but is much clearer A description fit for React itself.