Hey @epochdevelectronics,
There are two ways to do this. If you're using React/Next.js, you can pass arbitrary data to your slices using the context
prop:
So, in your page.js
file, you could pass the phone data into your <SliceZone>
and then access that data on the slice level:
import { createClient } from "@/prismicio";
export default async function Page({ params }) {
const client = createClient();
const page = await client.getByUID("samsung_phone_product", params.uid);
return (<SliceZone
slices={page.data.slices}
components={components}
context={page}
/>);
}
The other option is with mapSliceZone()
:
This way you can query data for each slice. However, it's probably excessively complicated for your use case.
Let me know if you have any other questions!
Sam