|
|
|
|
|
by basil-rash
2684 days ago
|
|
This also ties in very cleanly with graphQL: import gql from 'graphql-tag';
import { useQuery } from 'react-apollo-hooks';
const GET_DOGS = gql`
{
dogs {
id
breed
}
}`;
const Dogs = () => {
const { data, error } = useQuery(GET_DOGS);
if (error) return `Error! ${error.message}`;
return (
<ul>
{data.dogs.map(dog => (
<li key={dog.id}>{dog.breed}</li>
))}
</ul>
);
};
https://github.com/trojanowski/react-apollo-hooks |
|