Thanks for your article, @myogeshchavan97
! This was a great explanation.
So from what I understand, React Hooks provide a way to do certain things in functional components, which were previously only possible in class components. Is that about right?
Thanks. With the addition of React Hooks, there is now no difference between class components and functional components.
You can do everything in the functional component that the class components offered.
The only difference between them is that there are no available hooks for getSnapshotBeforeUpdate, getDerivedStateFromError and componentDidCatch lifecycle method of class components.
So If you need to use these lifecycle methods, you need to use class components instead of functional components
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Good article! I'm new to React, so I would love to see an actual code example of a Hook and how to use it.
My next article would feature some real-life code examples. Hit the follow button to stay tuned :)
@cariehl check out this article for React Hooks with actual code examples
Thanks for your article, @myogeshchavan97 ! This was a great explanation.
So from what I understand, React Hooks provide a way to do certain things in functional components, which were previously only possible in class components. Is that about right?
Thanks. With the addition of React Hooks, there is now no difference between class components and functional components.
You can do everything in the functional component that the class components offered.
The only difference between them is that there are no available hooks for getSnapshotBeforeUpdate, getDerivedStateFromError and componentDidCatch lifecycle method of class components.
So If you need to use these lifecycle methods, you need to use class components instead of functional components