Editing Existing Entries

Learn how to edit existing entries by implementing autosave.

In this lesson, we're going to take a look at how we can edit each field of a single student. For this, we're going to use a generic function that will work for all fields, and it'll function as an autosave. Any field that is updated will be immediately saved. This is because we're using an on:keyup event listener that triggers an update on each keystroke.

The update function

We need a function that accepts a property as a string and sets that to the event.target.value, then updates the student in the `state`, as well as in local storage. This is what our function will look like:

Get hands-on with 1200+ tech skills courses.