"Inline" ky extend? #639
Replies: 2 comments
-
It might help if you could show an example of how you want it to work. From what I can tell, the current |
Beta Was this translation helpful? Give feedback.
-
Thanks for getting back. Your answer makes sense, but I forgot some crucial info 😅 I'm using a hook generator library (kubb for React Query) in that monorepo package, and it needs a client instance (ky) to point to when it generates the hooks queries. Will try to create a simple example to share |
Beta Was this translation helpful? Give feedback.
-
I have the following situation:
since there could be env/app specific overrides for the ky client in each app (prefixUrl, hooks, ...), I'd like to have an "inline" extend -> the idea would be to import the ky client into the app of usage, do specific overrides (extends). It would apply automatically from the perspective of the lib.
TLDR: As far as I figured,
ky.extend
creates a new instance. I could use a "singleton" instance in this situation that could be extendable from for each app that uses the lib.is this possible? is there a better approach to this problem?
Beta Was this translation helpful? Give feedback.
All reactions