Understanding Basic React Hooks pt.1
To start things off, in order to continue on with this basic tutorial (that I’m mostly making for myself to help me better understand hooks) you would first need to know what are functional components, props, state, you know the basics of React. I will continue on with this series as I continue to learn more on hooks for now this what I have come to know so far from hooks.
Get andy reyes’s stories in your inbox
Join Medium for free to get updates from this writer.
Hooks isa new feature that was introduced in React v 16.8. It allows the developer to use React features without the need of writing a class. Like for example the state of a component. Before hooks you could only use state within class components or with Redux. With Hooks you can now use state in a functional component. Another tip that I have learned recently is that hooks do not seem to work in class components.
So you’re asking yourself why do you need hooks when there is already Redux. Well to me Redux is pretty freaking tough to understand. I’m still struggling with it still after school. There are some good reasons for hooks like making the code harder to follow because before you would have to wrap multiple components onto each other to share functionality. So there is a necessity to share stateful logic in a convenient way. With hooks it allows us to reuse stateful logic without changing the component hierarchy. To use hooks you would have to have React v16.8 and its completely backwards-compatible.





