Hooks in React JS
What are Hooks
- In old React version, we were using class-based components.
- Now class-based components are not much used in React.
- So to achieve state, lifecycle, other features in functional components, we use hooks.
Why We Need Hooks
- To use React features like state and lifecycle methods in functional components.
History of Hooks
- Hooks were introduced to replace class components with functional components using special functions.
Some Hook Names
useState
useEffect
useContext
useRef
useReducer
- etc.