DEV Community

loading...

Discussion on: Hooks in React

Collapse
cariehl profile image
Cooper Riehl

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?

Thread Thread
myogeshchavan97 profile image
Yogesh Chavan

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