Closed geohuz closed 1 year ago
Yes, you can initialize the query client manually.
export const queryClient = new QueryClient({ RootStore });
queryClient.init(initialData, env); // internally calls RootStore.create(initialData, env)
const rootStore = queryClient.rootStore;
@k-ode thanks! That's fair enough.
In react-router v6 there is a data router which expose function
action/loader
calls fetch api, but these functions are out of component scope, I'm wondering how can I reference the rootStore from the normal function?