-
I see we can use tanstack query in a component, And pass the store as a prop to sub components, Is there a way to create somewhere & then "import" the store instead ? This same code from a Svelte component, if I place it in a .ts file, I makes me an error const myData = createQuery({
queryKey: ['optimistic'],
queryFn: fetchDataQuery,
})
|
Beta Was this translation helpful? Give feedback.
Answered by
woojunro
Jul 30, 2024
Replies: 2 comments 2 replies
-
No one ? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'd been facing the same issue, but now I'm reusing a query like: $lib/stores/queriesexport const useSomethingQuery = () =>
createQuery({
queryKey: ['something'],
queryFn: getSomething,
}); +page.svelte<script lang="ts">
import { useSomethingQuery } from '$lib/stores/queries';
const something = useSomethingQuery();
// ...
</script> |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
MarArMar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd been facing the same issue, but now I'm reusing a query like:
$lib/stores/queries
+page.svelte