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
- The form uses a function in its
actionprop - No result is shown before submitting
- After submitting,
#resultsaysSubscribed: asha@example.com - 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.