3 ms·
This is not at all standard practice. It should be noted that just because you read something in a post on hacker news doesn't mean it's a good idea, common pra
by zarathustreal 5y ago
This is not at all standard practice. It should be noted that just because you read something in a post on hacker news doesn't mean it's a good idea, common practice, or even well-reasoned. OP for example is making extensive use of Hooks, which are well-known not to be the best solution to the problem of state management within React.
For example, useState leads to prop drilling, coupling, and cumbersome usage patterns.
React is a declarative rendering library, it should handle:
A. What DOM elements are created?
B. How are those DOM elements structured?
C. What styles and attributes do those DOM elements have?
- pizzeriafrida 5y ago> use of Hooks, which are well-known not to be the best solution to the problem of state management within React. I swear the introduction of Hooks threw such a monkey wrench into the ecosystem. They're just powerful enough to seem like an okay thing to use 100% of the time... I thought we all agreed that React's ultimate destination was obscurity while it quietly became the runtime target and developers just had to return dom structures as data from functions. But they got greedy, and didn't want to go down like that, and now we have a worse version of redux instead of building on top of react-redux. Perhaps my perception is wrong, in which case apologies and I'm happy to learn and listen.
- dragonwriter 5y ago> OP for example is making extensive use of Hooks, which are well-known not to be the best solution to the problem of state management within React. Hooks are fine. Using React’s built in Hooks [0] for nonlocal state management is a bad idea, but using, say, react-redux and useSelector/useDispatch is a different story. Well, if you use useState for something other than local component state, but that’s pretty expressly not using it correctly. [0] which are fine for local, intracomponent, state management, including within groups of components that are tightly logically coupled so that implementation coupling isn’t really adding an additional burden.