The latest version of REACT added the Hooks API which is really impressive, it gives developers a more direct and simpler way to implement react features such as state and lifecycle methods in function components, without building or converting functions to class components. In addition to these features, the API is extensible and allows developers to write their own hooks as well.
Hooks is an opt-in feature and is backward compatible. And while it offers a replacement to class components, their inclusion does not mean that class components are going away. The React team has no plans to do away with class components.
As the name says, Hooks allows your function component to hook into React features such as state and lifecycle methods. This opens up your components to a number of possibilities. like, you can upgrade your static function component to include the local state in about two lines of code, without the need to structurally refactor the component in any form.
Additionally, developers can write their own hooks to extend the pattern. Custom hooks can use the built-in hooks to create customized behavior that can be reused.
The Hooks API consists of two fundamental and primary hooks which are explained below. In addition to these fundamental hooks, there are a number of auxiliary hooks that can be used for advanced behavior.