Pass props to slicezone using "@prismicio/react"

Sorry, I just read the whole documentation and the props need to be passed as context.
Here's how I did it:
page code:

<SliceZone slices={page.data.slices} components={components} context={tags}/>

slice code:

const Tags = ({ slice, context }) => {
  console.log("slice context: ", context)
  return (
    <section
      data-slice-type={slice.slice_type}
      data-slice-variation={slice.variation}
    >
      <Stack>
        {context.map((tag) => {
          return <Chip key={tag} label={tag} onClick={handleClick()} />
        })}
      </Stack>
    </section>
  )
}

export default Tags
2 Likes