From the course: Build a React Application Using AWS Amplify

Unlock the full course today

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

Execute a GraphQL query from React

Execute a GraphQL query from React - Amazon Web Services (AWS) Tutorial

From the course: Build a React Application Using AWS Amplify

Start my 1-month free trial

Execute a GraphQL query from React

- [Instructor] The time has come to do really the most exciting part of this entire project. And that is connecting the backend and the API that you've been setting up most recently with the front end, both the React components that we've built as well as the code that's been generated by Amplify. So I've got my products component up, and we already have a query for listing products. We need to do a little bit of import work first though. In addition to React, we want to pull in both use state and use effect. Those are both going to be very, very important, and those are typical React calls. We also need to pull in a couple of things from AWS Amplify. So we need API, and we need GraphQL operation. And if you make the mistake I do and capitalize QL, then it's not going to work. So go ahead and make sure that's lowercase. And those are both in the AWS Amplify packages we already have. So once you have those, you're ready to…

Contents