|
|
|
|
|
by rhaway84773
1041 days ago
|
|
But it does reflect so much that’s wrong with the React development. Creating a first class hook whose only purpose is to wrap another first class hook, all so you can pass in a function rather than a function that returns a function. |
|
About a year before hooks was introduced it was discovered by multiple teams that inline anonymous JSX functions could create big performance issues. This was particularly felt in react native development. The solution back then was to do the whole .bind(this) to your callback methods in your react classes.
Because of this (my guess) is the react team wanted to make it extremely obvious how you could use closure state as opposed to private method callbacks when they went intro hooks, without teams having to worry about taking a performance penalty with inline callbacks. It was not obvious to me (and I’m sure many others) when hooks came out that you could memoize functions before rendering.
Again, I get the redundancy point and maybe at this point it could be deprecated but I think you have to think about where the community was before hooks.