Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

281
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda