Updating Data

Learn how to update the server data.

The setItem method can also be used to update the data. To demonstrate this, we will add a new section to the project to toggle the posts featured property. This will change the background color of the post to highlight it.

The update process

The process is similar to adding a new post. The process is explained below:

  • Create a form to add the post ID to update and a checkbox to toggle the featured setting.

  • Call a function to trigger a PUT request.

  • Retrieve our existing posts from the store. ...