How do I get urql graphql data in another component

333 Views Asked by At

I have code like this in my __layout.svelte file

    const store = operationStore(QUERY_CURRENT_USER);
    query(store);

and I can successfully use it like this in that same component like this

    $store.data.firstName

My problem is that I cannot work out a way to access this graphql data in other components within my app. I can add the query code (first block) again but that doesn't feel like the best way of doing it and ties each component that uses some of that data with that particular query.

I am using SvelteKit and @urql/svelte.

0

There are 0 best solutions below