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

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Reading DynamoDB data with a React app

Reading DynamoDB data with a React app

- [Instructor] We've done one query to list the todos. Now we're going to look at another query to get a single todo, that getTodo. This will be fetched based on the ID of the todo. So first I want to look at the code that was generated to see that the ID is the parameter. So here back in the queries.js, I have the listTodos that we just added and now we have the getTodo and it requires the ID be passed in. But otherwise it's pretty similar. If I wanted to get a single todo, I can use getTodo by ID or with the listTodos, I could supply things like filter and limit and those types of parameters. So let's do the getTodo and then we'll have both of our queries that were generated for us in the code. So looking at our App.js, I need to import the getTodos and I can do that on the same line as the listTodos. I put a comma after listTodos and then I also import the getTodo. Now I need to write a function. I'm going to base it off…

Contents