useState
useState is a Hook in React that lets function components add stateful logic. It is imported from the React library and is used only within functional components or custom hooks. When called, useState returns a pair: the current state value and a function to update that value. You can use array destructuring to assign them: [state, setState]. You may call useState multiple times in a single component to manage independent pieces of state.
The initial state can be a value, such as 0, or a function that returns the initial
In contrast to class components, state in functional components with useState is isolated per hook call. Rules