T
TanStack•3y ago
continuing-cyan

react-query + pocketbase sdk

Hello, can someone please tell me where I should init my PocketBase SDK API client (https://github.com/pocketbase/js-sdk#usage) so I can use it in all my app components with react-query. What is the best practice for this ? Wrapping the react-query context provider in another provider for the client ? Or init and importing the client from a global store (zustand in my case) ? I saw an example that init the client + create the fetch functions using the client in a config.js file and then just imports the fetch functions in the rest of the code, but it doesn't seem very scalable.
GitHub
GitHub - pocketbase/js-sdk: PocketBase JavaScript SDK
PocketBase JavaScript SDK. Contribute to pocketbase/js-sdk development by creating an account on GitHub.
1 Reply
equal-jade
equal-jade•3y ago
I don't think this has much to do with react-query. Just figure how you would do it without react-query, then take it from there 🙂

Did you find this page helpful?