I need help with react-query library.
I fetch a list of objects and then for everyone I need to fetch additional data from another service. How should I do this with react-query useQuery
hook?
Example 1:
const { data} = useQuery("USERS", fetchUsers);
data.map(user => useQuery(["ACCOUNT", {userId: user.id}],
({userId}) => fetchAccount(userId)));
Error:
ESLint: React Hook
useQuery
cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function. (react-hooks/rules-of-hooks)