Let's build a real app!
How can this be achieved?
Hooks are functions that let you "hook into" React state and lifecycle features.
The Hook function is called in the render function.
Depending on the Hook, it may have parameters and may provide a return value to access the provided functionality.
The eslint-plugin-react-hooks enforces these rules.
Before Hooks were introduced in 2019, features like state management required the use of class components .
With Hooks these features can be used in function components and thereby makes the code simpler and better reusable .
The array destructuring makes it easy to use multiple states in a component.
The onChange prop is a function which is called when the input is changed.
Use event.target.value to access the value which was entered.
Event handlers like onChange receive an instance of SyntheticEvent .
This is a wrapper for the native events , ensuring a consistent API and functionality across browsers.
We learned…