How to use useGetStaticProps to perform extra queries

I want to query related/previous/next articles. I'm using useGetStaticProps provided in SliceZone hooks. I don't see any options to perform extra queries.

Any help will be appreciated!

Kris

Hi @kris ,

useGetStaticProps can only query one document per page. If you want to query the next/previous document automatically, you can use getStaticProps, like this:

You could also define your next/back buttons in your document, with a Content Relationship, and then useGetStaticProps would provide all of the data you need.

Let me know if I understood your question correctly, or if you have any others :slight_smile:

Best,
Sam

Thanks! This is how I ended up implementing it yesterday. I was just wondering if I can use the useGetStaticProps hook for multiple queries. But for that scenario, I fell back to how I used to query before slice zone :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.