scrimba
Build an App with React and GraphQL
Adding a GraphQL query and creating our Pokemon component!
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Adding a GraphQL query and creating our Pokemon component!
AboutCommentsNotes
Adding a GraphQL query and creating our Pokemon component!
Expand for more info
containers
PokemonsContainer.js
run
preview
console
import React from 'react';
import { useQuery } from '@apollo/react-hooks';
import { Pokemon } from '../components/Pokemon';

export function PokemonsContainer() {
const { data: { pokemons = [] } = {} } = useQuery(GET_POKEMONS, {
variables: { first: 9 },
});

return (
<div className="container">
{pokemons && pokemons.map(pokemon => <Pokemon key={pokemon.id} pokemon={pokemon} />)}
</div>
);
}
Console
/index.html
-10:32