Use same query across multiple pages in multi-page app

Hey there,

I was wondering what the recommended way for using the same query on multiple pages in a multi-page app is?

I have a query that fetches basic resources that I need on multiple pages, but it's not state that should be global. I guess the way would be to extract a query to the query library and then to use the same query on both pages, but it seems they would then need to be named differently, even though they're doing the same?

Any tips would be appreciated!

Hi @Janosch_Herrmann, great question!

The tradeoff of extracting the query to the QL is that it would be triggered once for every app that uses it, which can be expensive depending on how many pages share this query. Therefore, I would recommend making it a Global query if it's needed for multiple pages.

1 Like

Hey Paulo, ok thanks for clarifying :slight_smile:

you are welcome! :slightly_smiling_face: