22.
What does the useState() hook do in React?
It creates state variables in a functional component.
It adds event handling to a class component.
It retrieves data from an API.
It styles the component based on its state.
Correct: A
The useState() hook is used to add state to a functional component in React. It allows us to declare state variables and access them within the component. By using useState(), we can manage and update the state of a component without needing to convert it into a class component.