Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step #10 - Query the API using GraphQL #18

Open
marciammart opened this issue May 3, 2023 · 0 comments
Open

Step #10 - Query the API using GraphQL #18

marciammart opened this issue May 3, 2023 · 0 comments

Comments

@marciammart
Copy link
Collaborator

GraphQL is a query language for APIs that allows you to query specific data from an endpoint. Let's test it by creating a copy of our React app and modifying it to use GraphQL.

  1. Copy your React app to another folder
    We will only need the home page for this
  2. Explore the GraphQL API
    We are going to the a GraphQL version of the TMDB API. Click here to access the sandbox and click on the Docs tab to explore the queries and types
  3. Setup the API in your new app
    Let's use Apollo Client for that. Here is the documentation on how to add it to you app.
  4. Use GraphQL to access the trending media

And that's it! By the end you should have a page that works just like the one you had using a REST API but this time you are using GraphQL and only requesting the data that you need, improving the performance of your app.

If you need some extra help understanding the syntax of GraphQL, here are some useful links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant