Questions:
What is the purpose of useState?
This question is to check if you can manage local component statue using hooks, since state is the heart of interactivity.
Sample Answer:
The React hook “useState” is used to declare a piece of state in Functional Components.
const [count, setCount] = useState(0);
Here in the above code, “count” is the current state value and “setCount” is the function to update that value.
React re-renders the component when the state changes.