I'm doing the tutorial - https://www.apollographql.com/docs/react/data/queries/ with a lazy graphQL. I have a function which let me get data by click button with lazy query to server. I wrapped it of anonymous function and put to onClick button. Could you help me to add another function to callback of getDog, to add some actions after useLazyQuery will finished.
const [getDog, { loading, data }] = useLazyQuery(GET_DOG_PHOTO);
I tried
const [getDog, { loading, data }] = {
useLazyQuery(CUSTOM_GQL);
return // some actions with data and return;
}
does not compile
<button onClick={
() => {
getDog();
return // some actions
}
}
some actions works only after second click.