Reader small image

You're reading from  Full Stack Web Development with Remix

Product typeBook
Published inNov 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781801075299
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Andre Landgraf
Andre Landgraf
author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf

Right arrow

Mutating data

Creating and updating data is just as important as fetching data. In this section, we will add an expense creation form and learn how to mutate data in Remix.

Mutating data without JavaScript

Remember the three-step process for building web UIs from Ryan Florence that we discussed in Chapter 1? The first step is to make the user experience work without JavaScript. After that, we add JavaScript to enhance the experience but ensure that the baseline implementation still works. This process is called progressive enhancement.

In this section, we use Remix's action function to handle incoming form submissions on the server. In the `action` function, we will validate the user data and write the new expense object to the database. Let's see how we can use the native form element to submit user data, without the need for client-side JavaScript:

  1. First, create a new route module for the expense creation form: app/routes/dashboard.expenses._index.tsx.

    We...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Full Stack Web Development with Remix
Published in: Nov 2023Publisher: PacktISBN-13: 9781801075299

Author (1)

author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf