Skip to content
Rung

01/12

No. 01Easy10 min

State: Build a Counter

Mission

Use the useState Hook so a component can remember a value and update the screen when it changes.

Tasks

  1. 1

    Import the useState Hook directly from react.

  2. 2

    Declare a state variable initialised to 0.

  3. 3

    Render the current value inside the <h1>.

  4. 4

    Make the button add 1 to the counter when clicked.