svelte-apollo icon indicating copy to clipboard operation
svelte-apollo copied to clipboard

Sharing the store amongst pages

Open neiled opened this issue 3 years ago • 1 comments

OK just trying to get my head in the right space sorry if it's a dumb question.

I have several 'pages' (Component siblings I guess, they are all top level) that all want to access 'Book's. What's the best way of sharing the query amongst multiple pages? I'd rather download the data once and then share the downloaded books store amongst the Pages. The only way I can think of doing this right now is to create the Books query at the App level and passing the store it creates to each page that is going to use it as a prop. Is that the right way?

neiled avatar Mar 19 '21 00:03 neiled

You could either rely on the Apollo Store or put the response of the query in a svelte store

flashspys avatar Apr 11 '21 21:04 flashspys