toss / suspensive

Manage asynchronous operations, timing, error handling, detecting intersection of elements, and caching easily and declaratively
https://suspensive.org
MIT License
509 stars 48 forks source link

[Feature]: useQueryClient #1267

Closed gwansikk closed 3 weeks ago

gwansikk commented 3 weeks ago

Package Scope

@suspensive/react-query

Description

ref: https://tkdodo.eu/blog/react-query-fa-qs#why-should-i-usequeryclient

It is sometimes necessary to create the queryClient inside the App component (as shown above). One example is when using server side rendering, because you want to avoid having multiple users share the same client.

<QueryClient>
  {(queryClient) => (
    <button
      onClick={() => queryClient.invalidateQueries({
        queryKey: ['items']
      })}
    >
      invalidate items
    </button>
  )}
</QueryClient>

Possible Solution

No response

etc.

No response

coauthors[bot] commented 3 weeks ago

People can be co-author:

Candidate Reasons Count Add this as commit message
@gwansikk https://github.com/toss/suspensive/issues/1267#issuecomment-2339641513 https://github.com/toss/suspensive/issues/1267 2 Co-authored-by: gwansikk <39869096+gwansikk@users.noreply.github.com>
gwansikk commented 3 weeks ago

related: https://github.com/toss/suspensive/issues/1251