How to use UseQuery in React.UseEffect? this is my simple query
const {allrecord} = useQuery(ME, {
onCompleted: ({ meTeacher}) => {
setUser(meIAM);
getRecords({
variables: {
orgId: meIAM.organization.id,
pagingArg: {},
},
}).then(({ data }) => displayRecord(data.record));
},
});
useEffect(() => {
console.log(allLocations)
}, []);
useQuery
inside theuseEffect
. You can use it outside and it's fine. – Nl.then(({ data }) => displayRecord(data.record), studentRecord(data.record))
– Sundried