Instagram
youtube
Facebook
Twitter

Introduction of Hooks

React Hooks

  • Hooks are added to react in the 16.8 version.
  • Hooks allow function components to access state and other react features without using class.
  • They are functions that "Hook" into react state and lifecycle feature.

Hook Rules

There are 3 rules for hooks:

  • Hooks can only be called inside React function components.
  • Hooks can only be called at the top level of a component.
  • Hooks cannot be conditional.

React Hooks Installation

npm install -g create-react-hook