Complete the code to import React and use the useState hook.
import React, { [1] } from 'react';
The useState hook is used to add state to functional components in React.
Complete the code to create a state variable called count with initial value 0.
const [count, [1]] = useState(0);
The second element returned by useState is the setter function to update the state.
Fix the error in the JSX to display the count variable inside a paragraph.
<p>The count is: [1]</p>In JSX, JavaScript expressions must be inside curly braces to be evaluated.
Fill both blanks to create a button that increments count when clicked.
<button onClick=[1]>[2]</button>
The onClick needs a function to update state. The button text should say 'Increment'.
Fill all three blanks to create a simple React component that shows a count and a button to increase it.
function Counter() {
const [[1], [2]] = useState(0);
return (
<div>
<p>Count: [3]</p>
<button onClick={() => [2]([1] + 1)}>Increase</button>
</div>
);
}The state variable is count, the setter is setCount, and the displayed value is count.