Form Action

Loading "Form Action"
๐Ÿงโ€โ™‚๏ธ I've added some backend code that will handle our form submission. It's at api/onboarding. You can find it in .
Note: the api.server.ts file is some magic from the Workshop app to make it so we can test things out with a backend server without having to actually set up a backend server. It's not something you'd use in a real app.
๐Ÿ‘จโ€๐Ÿ’ผ Great! So we want the user's form submission to be sent along to api/onboarding. By default, when a form is submitted, the browser will send the form data to the current page's URL. We can change this by adding an action attribute to the form element:
<form action="path/to/backend/route">
	<!-- ... -->
</form>
Go ahead and add an action attribute to the form element.
๐Ÿฆ‰ You may notice a full page refresh when you submit the form. We'll talk about this in a future step.
Login to get access to the exclusive discord channel.
  • โš›๏ธFundamentals
    First Four Exercises are Free!
    Kent C. Dodds โ—† ๐Ÿš€๐Ÿ†๐ŸŒŒ:
    To make sure this shows up in the fundamentals thread. Isn't it exciting the first four exercises of...
    1 ยท 4 days ago
  • General
    Welcome to EpicReact.dev! Say Hello ๐Ÿ‘‹
    Kent C. Dodds โ—† ๐Ÿš€๐Ÿ†๐ŸŒŒ:
    Welcome to the first of many posts in the EpicReact.dev channel! Take a moment to introduce yourself...
    0 ยท 4 days ago