Hooks were added to React in version 16.8. They allow you to use state and other React features without writing a class component.
The Golden Rules of Hooks
- Only call Hooks at the top level: Don’t call Hooks inside loops, conditions, or nested functions.
- Only call Hooks from React functions: Call them from React functional components or custom Hooks.