I'm moving some Redux stores out of Redux into reactQuery as they dont need to be inside Redux. Now I have moved out a country array from a store to a custom hook that calls a API with rectQuery.
Now another saga needs to use the country array. But looks like I can not make a hook call in a saga. I get the error:
Error: React Hook "useCountries" is called in function "onSearchInit" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use". react-hooks/rules-of-hooks
I import my hook like this:
import { useCountries } from "@mysite/hooks/useCountries";
And use it like this:
const { countries } = useCountries();
I'm no expert in Redux. Is there another way to get my hook data into the saga?