lukemorales / query-key-factory

A library for creating typesafe standardized query keys, useful for cache management in @tanstack/query
https://www.npmjs.com/package/@lukemorales/query-key-factory
MIT License
1.2k stars 32 forks source link

Is it possible using variable when create query key? #94

Open h0ngwon opened 3 months ago

h0ngwon commented 3 months ago

I'm wondering using variable is possible. here is my current query key for example

function test(a: string, b: string) {
  return useQuery({
    queryKey: ["key_one", a, "key_two", b],
    queryFn: () => testFunction(a, b),
  });
}

In this situation how can I make queryKey like in above queryKey?

linear[bot] commented 3 months ago

OSS-15 Is it possible using variable when create query key?