Hooks in React JS

What are Hooks

  1. In old React version, we were using class-based components.
  2. Now class-based components are not much used in React.
  3. So to achieve state, lifecycle, other features in functional components, we use hooks.


Why We Need Hooks

  1. To use React features like state and lifecycle methods in functional components.


History of Hooks

  1. Hooks were introduced to replace class components with functional components using special functions.


Some Hook Names

  1. useState
  2. useEffect
  3. useContext
  4. useRef
  5. useReducer
  6. etc.