Hooks provide stateful components, without needing to use classes.
Prior to the advent of Hooks, function components were used for presentation purposes, and classes were used when working with state/logic. In a nutshell, hooks add state to functional components.
Hooks provide a number of benefits which you don't currently get with 'stateful' class components, including;
-
Cleaner components - hooks provides a way for related logic to be grouped in sensible methods, opposed to the prescribed lifecycle methods bundled into React
classcomponents. -
A better way for sharing functionality - stateful logic can be taken away from components, providing easier reuse and testability. Classes handled all logic directly in the component.
This project was bootstrapped with Create React App.