Historically, state could only be used in class components. Using hooks, you can apply state to functional components too.
Can we use state in functional component?
Stateless Functional Components can't have state, you will need to use a regular React Component if you want to have state within the component.
How do you pass a state in a functional component?
Passing State to a Component
To pass the state into another component, you can pass it as a prop. Then, inside <ExampleComponent /> , you can access the data as this. props.