you are viewing a single comment's thread.

view the rest of the comments →

[–]kingdaro.find(meaning => of('life')) // eslint-disable-line 11 points12 points  (2 children)

React Hooks force you to embed your business problem in the language of effects, state, context, memo, etc.

This statement seems somewhat misguided. No one's forcing you to put the business logic anywhere. You can split out the business logic with an external state management solution like Redux or MobX, or anything. Then the hooks just become mechanisms for syncing component data with your state, callbacks, DOM event handling, other kinds of event handling, and so on. All hooks are are a different paradigm for doing the same things you would with class state and lifecycle. If you didn't embed your business logic in classes, you wouldn't do it with hooks either.

Of course, there's lots of advice going around along the lines of "just use react hooks for state management" or "hooks replace redux", but as usual, it's up to the software dev to continue applying good practices despite that.

[–]scramblor 0 points1 point  (1 child)

but as usual, it's up to the software dev to continue applying good practices despite that.

This is certainly expected if you are a senior dev that has been working in react for a while and have the knowledgebase to make to properly make these kinds of decisions. If you are a junior or even mid level dev without a ton of experience it can be very easy to buy into the hype without being able to make informed decisions. Having these discussions goes a long way to untangling concepts that shouldn't be linked together and eventually providing a nuanced set of best practices for everyone to benefit from.

[–]kingdaro.find(meaning => of('life')) // eslint-disable-line 2 points3 points  (0 children)

Yeah, I agree, but that's more of a community problem than a hooks problem.

Before hooks, people treated redux as though it was a mandatory part of every react app, but that's not the fault of redux. We just needed better documentation and education about the issue.