Introducing Hooks
reactjs.org
Introducing Hooks
1–10 of 310 posts
Re: Introducing Hooks
#2The call order thing seems odd. Don't know how to sell this to people.
Re: Introducing Hooks
#3Re: Introducing Hooks
#4> In our observation, classes are the biggest barrier to learning React. You have to understand how this works in JavaScript, which is very different from how it works in most languages. You have to remember to bind the event handlers. Without unstable syntax proposals, the code is very verbose. People can understand props, state, and top-down data flow perfectly well but still struggle with classes. The distinction between function and class components in React and when to use each one leads to disagreements even between experienced React developers.
A framework shouldn't be designed around the fact that people don't know the language they are using, right?
Anyway, those hooks look like a good way to solve the issues listed above. Can't wait to try it out!
Re: Introducing Hooks
#5https://github.com/acdlite/recompose/blob/master/docs/API.md
Re: Introducing Hooks
#6While I agree that class components has always felt like a workaround to bypass the limitations of function components, and that it's obviously annoying to rewrite a function component to a class component just to add a state or a lifecycle method, the following explanation sounds a bit silly to me: > In our observation, classes are the biggest barrier to learning React. You have to understand how this works in JavaS…
Re: Introducing Hooks
#7Re: Introducing Hooks
#8Re: Introducing Hooks
#9While I agree that class components has always felt like a workaround to bypass the limitations of function components, and that it's obviously annoying to rewrite a function component to a class component just to add a state or a lifecycle method, the following explanation sounds a bit silly to me: > In our observation, classes are the biggest barrier to learning React. You have to understand how this works in JavaS…
I think the point is that they want to provide two ways to do simple things: classes and functions. Functions have better performance, classes are more flexible.
Re: Introducing Hooks
#10This is interesting. I'll have to spend some time mulling over this before the benefits sink in. It seems like a much more confusing and less composable API than recompose, which is how I add state, lifecycle, and other React class features to functional components. I've been completely avoiding React classes for a while now and using stateless components with recompose for over a year now, and I find it to be a wond…