Querying data from inside a slice

Hi Education Team,

I'm using Next.js with Prismic and I was wondering if it's possible to query (server-side) data inside a slice, for example, if I have a slice that needs to get the amount of stars a certain GitHub repo has to then display it. If it's not possible to do that, how can I pass data I fetch on the index.js page, for example, and pass it down to every slice on the page? The SliceZone already has every prop being passed to it:
<SliceZone {...props} resolver={resolver} />
But inside the slices I only have access to the slice object, I haven't access to anything that is passed down to the SliceZone.

Best regards,
João Rodrigues

Hey @deepset ,

Thanks for posting this question, and welcome to the Prismic community :slight_smile:

You can use the sliceProps property to pass props to your Slices in Next and Vue. Does that address your use case? If not, let me know.

Sam

1 Like

Ah nice! I managed to do what I wanted but this is definitely super useful to know, thx :slight_smile:

1 Like

Great! Let me know if you have any other questions :slight_smile:

1 Like