reactjs – How to use AWS Amplify GraphQL search and aggregate queries in React code?

In the current AWS Amplify React documentation there are no any examples showing how to use these GraphQL queries in React code. Can someone please post an example here. Authentication method needs be the API_KEY. Thanks.

query SearchStudentsByEmail {
  searchStudents(filter: { name: { eq: "Rene Brandel" } }) {
    items {
      id
      name
      email
    }
  }
}

Tried below, but it’s returning an empty result. Zero items.

const recipes = await client.graphql({ 
            query: searchStudents,
            authMode: 'apiKey'
        }); 

Read more here: Source link