useKindeBrowserClient endpoint on hook calls
Is useKindeBrowserClient supposed to call/setup endpoint on each hook call? e.g. I'm calling this hook throughout my component tree and it is making 30+ requests to this url just to load the page. I'm assuming it should instantiate the client once and use it throught the application, like tanstack/query does for example?
1 Reply
Hi Ej,
Yes —
Yes —
useKindeBrowserClient
will call your /api/auth/
(or equivalent) endpoint each time it’s used in a component. That means if you call it throughout your component tree, you’ll see multiple requests being made.
It’s not like TanStack Query, which creates a client instance once and handles caching/deduplication globally. With Kinde’s hook, the fetch happens per usage. For best results, call it higher up in your tree and pass the auth state down, or wrap it in your own context/provider to avoid repeated calls.