3 ms·
Consider this code snippet using Apollo React Client: const Dogs = ({ onDogSelected }) => ( <Query query={GET_DOGS}> {({ loading, error, data
by typon 7y ago
Consider this code snippet using Apollo React Client:
const Dogs = ({ onDogSelected }) => (
<Query query={GET_DOGS}>
{({ loading, error, data }) => {
if (loading) return 'Loading...';
if (error) return `Error! ${error.message}`;
return (
<select name="dog" onChange={onDogSelected}>
{data.dogs.map(dog => (
<option key={dog.id} value={dog.breed}>
{dog.breed}
</option>
))}
</select>
);
}}
</Query>
);
- bobobooey 7y agoYou could still wrap this in a suspense wrapper.