Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

288
Views
Graphql Apollo Client query by ID

I'm new to GraphQL and I'm trying to build a work around project for training purposes.

For this project I'm using an external GraphQL API to get some movies. I'm making my requests through Apollo-Client the newest version and display them within a small react native app and the useQuery hook from the Apollo-Client library. No particular backend for this app.

I'm currently trying to display 2 different screens :

  • The main one with a list of all the movies. Got them with this query :
const GET_MOVIES = gql `
{
allMovies {
movies {
title 
id } 
  } 
} 
`

Everything is ok so far. But I'm stuck with the next part. I'm trying to use this id i got from a movie (map through movies) as a variable for my next request which i want to use to display my next screen. The movie screen.

I got the id but i don't know how to use it as a variable and pass it to my query to then get all the movie informations i need from this particular movie.

I found something like this :

const GET_THIS_MOVIE = gql `
{
movie (id : $movieID) {
title
.... 
.... 
  } 
} 
`

But i don't know how to use the id i got as this movieID variable. Knowing this id will change depending on the movie selected.

A precise answer with some code would be really appreciated as im new to GraphQL

Thanks for your help !

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!