Introduction

Read the basic background for inventing React Hooks in React.

React continues to be the most popular front-end library among JavaScript developers that help build better user interfaces.

Many engineers and developers love the functional programming principles that React promotes. Certain concepts like pure functions, props, state, and stateful logic allow developers to write feature rich web applications. This works very well except for one caveat.

React needed improvement in one area: sharing stateful logic in React components. Higher order components partially solves this issue. But, higher code components do not achieve the best code composition, code reuse, and unit testing ability.

This is where React Hooks come in handy. With React Hooks, there is the freedom to create and share stateful logic in React components. It is even possible to share such hooks publicly as “npm” (node package manager) packages.

These are called “React Hooks” because they allow developers to hook into React features that were previously unexposed publicly.