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

useState used with no setter #13

Open
jdegand opened this issue Sep 26, 2024 · 1 comment
Open

useState used with no setter #13

jdegand opened this issue Sep 26, 2024 · 1 comment

Comments

@jdegand
Copy link

jdegand commented Sep 26, 2024

Usually, this is a code smell.

In app/provider.tsx, you used const [queryClient] = useState(() => new QueryClient());.

The tanstack docs define the queryClient outside of the function.

const queryClient = new QueryClient()

export default function App() {
  return (
    <QueryClientProvider client={queryClient}>
      <Example />
    </QueryClientProvider>
  )
}

I think useRef could also be a potential solution.

@michaelshimeles
Copy link
Owner

that's correct, could you do a PR sir?

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

2 participants