From the course: AWS and React: Creating Full-Stack Apps (2019)
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
CRUD DynamoDB data with a React app - Amazon Web Services (AWS) Tutorial
From the course: AWS and React: Creating Full-Stack Apps (2019)
CRUD DynamoDB data with a React app
- [Instructor] So just like Amplify generated us code for queries, it also generated us code for mutations. So let's look at that. So we have the src/graphql/mutations. So we have deleteTodo, updateTodo, createTodo. That's what we want to work on next. We're going to create a new Todo. So we're going to back to the code in the Visual Studio Code App. And now we want to create a new Todo. So after line 18 on line 19, I'll type const todo. This'll be our new todo. And I'm going to set in curly braces name and I'll name this app so we know it's coming from the app and the description will be new todo. We don't have to set the ID because we want that generated by the system. Now I'll do const newTodo and set that equal to API.graphql, open paren, graphqlOperation, open parent mutations, so we have to import the mutations. So back up at the top, right under line seven, we're going to import asterisk as mutations…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.