Ria Choi
← Portfolio

RSVP Form

A React form exercise about keeping user input and its confirmation in sync.

RSVP Form

I used a simple RSVP form to practice what happens between typing values and seeing a confirmation. I wanted the confirmation to reflect the values the guest had just entered, including party size and whether additional guests were coming.

Keeping entered values in one place

The React component controls the name, email, attendee count, dietary preferences, and guest selection. Browser input types and required fields provide the first validation pass. The submit handler prevents the browser from navigating away and changes the submitted flag.

JavaScript
export function EventRSVPForm() {
  const [submitted, setSubmitted] = useState(false);
  const [name, setName] = useState('');
  const [email, setEmail] = useState('');
  const [attendees, setAttendees] = useState('');
  const [preferences, setPreferences] = useState('');
  const [guests, setGuests] = useState('No');

  const handleSubmit = (e) => {
    e.preventDefault();
    setSubmitted(true);

  }

Rendering the confirmation from the same inputs

The submitted state switches the interface to a confirmation using the existing input values. This keeps the summary tied to the form the guest just filled in. Because the exercise uses local browser state, the confirmation shows the UI flow without storing an RSVP.

What I learned

Building the confirmation exposed what the form needed to keep in state. Once the fields were controlled, the confirmation could read those values directly.