Command Palette

Search for a command to run...

Hectal
Phase 19: React 19: Actions and Modern Forms
React · Exercise 1 of 5Next
Beginner

A newsletter form with a form action

Turn the newsletter form into a React 19 form action: pass an async function to <form action={...}> (no onSubmit).

The function reads the email field from the FormData, waits for fakeSubscribe(email) (300 ms) and stores the answer in state.

After it finishes, show <p id="result">Subscribed: <email></p> (for example Subscribed: asha@example.com). The email box should be empty again: React resets the form for you.

What Check tests

  1. The form uses a function in its action prop
  2. No result is shown before submitting
  3. After submitting, #result says Subscribed: asha@example.com
  4. The email box was reset to empty

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.