In addition to using the AWS AppSync console, we can also use the AWS Amplify CLI to create GraphQL APIs & the AWS Amplify to interact with the API. In this video, we'll look at an alternate way to create & manage your AppSync GraphQL API.
Amplify seems to be a bit more straightforward requiring less code than the previous example which used HOC's. Thanks for the shorts
btw, there's a bit of a typo before the ComponentDidMount. asynce, not async
state = { restaurants: [] }
asynce componentDidMount() {
const data = await API.graphql(graphqlOperation(query))
this.setState({
restaurants: data.data.listRestaurants.items
})
}
}```
Really good course. I do have a question in regards to "usage". What is the reason to use Amplify? I see you didn't use "connect" like you did with the aws-appsync, but rather just used the API. I would like to know what the use case is to use one way or the other.
Dean, as you noted there are two main GraphQL clients for AWS AppSync: AWS Amplify & AWS AppSync SDK.
The AWS Amplify GraphQL client does not yet support offline but has a simpler API.
The AWS AppSync SDK does support offline out of the box & has a similar API to the Apollo client since it was the base for the client & also uses Apollo React & therefore inherits the Apollo React API.
OMG this is sooooo simple °□° thanks Mr. Nader amazing content