React Hooks, which you gonna use the most.

Why you should move from class components to functional components?

PS - If you are already using class components in your project don’t rush to pick up hooks. It is optional you can still work with your existing components, refactoring everything I won’t suggest.

1. useState —

2. useEffect —

When using hooks and functional components, we no longer have access to React lifecycle methods like componentDidMount, componentDidUpdate

  • When a component receives new props that change its state
  • When a component makes an API call and does something with the response (e.g, changes the state).

Custom Hooks —

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dia Bhavsar

Dia Bhavsar

Front-end Web developer. Interested in React, Angular, Node, Typescript.