Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No QueryClient set, use QueryClientProvider to set one #7

Open
jhanstra opened this issue Nov 16, 2024 · 4 comments
Open

Error: No QueryClient set, use QueryClientProvider to set one #7

jhanstra opened this issue Nov 16, 2024 · 4 comments

Comments

@jhanstra
Copy link

jhanstra commented Nov 16, 2024

No idea why this happens, but when I tried to implement react-scan in my React Native / Expo project, I get this error in reference to @tanstack/react-query set-up. When I remove the scan() method from the _layout file, the error goes away. Strange. Appreciate your work on this and excited to use it in the future!

Error: No QueryClient set, use QueryClientProvider to set one

My _layout file looks like this:

import { scan } from "react-scan";
import React, { useEffect, useState } from "react";

scan({
  enabled: process.env.NODE_ENV === "development",
  log: true, // logs render info to console (default: false)
  clearLog: false, // clears the console per group of renders (default: false)
});

export const Providers = () => {
  const [queryClient] = useState(
    () => new QueryClient(DEFAULT_QUERY_CLIENT_OPTIONS),
  );

  return (
    <ConfigProvider config={{ ...config, supabase, nanoid }}>
      <StatusBar style="dark" />
      <QueryClientProvider client={queryClient}>
        {...more providers and the main UI layout}
      </QueryClientProvider>
    </ConfigProvider>
  );
};

export default Sentry.wrap(Providers);
@aidenybai
Copy link
Owner

@jhanstra we don't support RN yet!

@0xFA11
Copy link

0xFA11 commented Nov 22, 2024

@aidenybai are you planning to support React Native some time in the future?

also, if you attempted to support, what were main issues/blockers? it'd be good to know if somebody were to consider contributing towards React Native support :)

@rikur
Copy link

rikur commented Nov 29, 2024

@rikur
Copy link

rikur commented Nov 29, 2024

Going to test the react-native branch :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants