From the course: AWS and React: Creating Full-Stack Apps (2019)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Testing DynamoDB CRUD with a React app

Testing DynamoDB CRUD with a React app - Amazon Web Services (AWS) Tutorial

From the course: AWS and React: Creating Full-Stack Apps (2019)

Start my 1-month free trial

Testing DynamoDB CRUD with a React app

- [Instructor] So now let's flush out the rest of our API in the code. Above function App, I'm going to write two new functions, one for update and one for delete. So on line 12, I'm going to type function updateTodo and it's going to take a todo and a newDescription and in the curly braces, the first thing I'm going to do is set that new description on the todo. So on line 13, I'll type todo, open square bracket, single quote, description and set that equal to the newDescription. Then I want to make the call to update it on the server, so I'll type API.graphql, open parentheses graphqlOperation. Open parentheses mutations.updateTodo and this is going to take a todo item, so I have comma, open curly braces, input:todo and this should update the item on the server. Below that on line 17, I'm going to type function deleteTodo and that's just going to take a todo. We really only need the ID, so you could pass that…

Contents