# Unsure how \`sliceProps\` works

**URL:** <https://community.prismic.io/t/unsure-how-sliceprops-works/13547>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [June 29, 2023, 2:42pm UTC](https://community.prismic.io/t/unsure-how-sliceprops-works/13547 "2023-06-29T14:42:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![constructivearchitec](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@constructivearchitec](https://community.prismic.io/u/constructivearchitec)\
**Post date:** [June 29, 2023, 2:42pm UTC](https://community.prismic.io/t/unsure-how-sliceprops-works/13547/1 "2023-06-29T14:42:00Z")

</div>

I'm developing a site based off the next JS blog starter project, currently trying to pass a simple prop into my slices:

```auto
  <SliceZone
          slices={project.data.slices}
          components={components}
          sliceProps={{ highlightBg: project.data.highlight_color }}
        />

```

In my slices, if i look at the `slice` data thats passed in:

```auto
const ImageBlock = ({ slice }) => {
  console.log({ slice });

```

There's no sign of the `sliceProp` object.

Maybe i'm missing something stupid, but the example [in your docs](https://prismic.io/docs/technical-reference-next-slicezone-nextjs#slicezone-) is more complicated than I need - it appears to target slices by name, index, or type? not sure what I would pass for these values, and I don't need to target any particular slice in this case. There's also mention of a `resolver` function, is that still neccesary? I see now your example project passes `components`, perhaps instead?

Some slightly more complete / up to date documentation would help here!

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [June 29, 2023, 3:35pm UTC](https://community.prismic.io/t/unsure-how-sliceprops-works/13547/2 "2023-06-29T15:35:08Z")

</div>

Hey there! I recommend checking out the Image field documentation withinformation on how to render the images in your app.

> **[Image](https://prismic.io/docs/image)**
>
> This article explains what the image field is and how to configure it in the custom type builder.

---

<div class="post-metadata">

**Author:** ![constructivearchitec](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@constructivearchitec](https://community.prismic.io/u/constructivearchitec)\
**Post date:** [June 29, 2023, 5:39pm UTC](https://community.prismic.io/t/unsure-how-sliceprops-works/13547/4 "2023-06-29T17:39:40Z")

</div>

Thanks @Pau, but perhaps my `ImageBlock` slice is a distraction here. Im definitely using ` <PrismicNextImage>` within it, and have other reasons to make a custom slice for it.

What I really need to know is for this slice, and others, how I can get the value of `highlightBG` which is defined at the page level.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [June 29, 2023, 6:42pm UTC](https://community.prismic.io/t/unsure-how-sliceprops-works/13547/5 "2023-06-29T18:42:17Z")

</div>

It is a top level field outside of a Slice, if that's the case then you just need to retrieve the data in `project`, then you should be able to find those fields in the first or second node of the response object. Have you tried to log the response in the terminal?

---

<div class="post-metadata">

**Author:** ![constructivearchitec](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@constructivearchitec](https://community.prismic.io/u/constructivearchitec)\
**Post date:** [June 30, 2023, 6:57pm UTC](https://community.prismic.io/t/unsure-how-sliceprops-works/13547/6 "2023-06-30T18:57:49Z")

</div>

Hmm no i'm not sure how I would do that... how do I access the `response` to log it from inside a slice component?

What is wrong with using `sliceProps`? it seems like the thing I should be using... does it not work? is it deprecated??

Basically i have 'project' pages which are like the example project blog post pages. Each project has a custom highlight color, some set stuff at the top of the page, and then slices that alternate between image and text blocks.

Sometimes those slices need to use the highlight color in their css. I can think of some hacky ways I might be able to acheive this, but passing the highlight color from the project page wrapper -\> `<SliceZone>` -\> slices seems clean? if it works!

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [July 3, 2023, 3:36pm UTC](https://community.prismic.io/t/unsure-how-sliceprops-works/13547/7 "2023-07-03T15:36:04Z")

</div>

Now you can use `context`, instead of `sliceprops`. See the following example

```auto
<SliceZone
   slices={project.data.slices}
   components={components}
   context={{ highlightBg: project.data.highlight_color }}
/>

```

> **[@prismicio/react Technical Reference](https://prismic.io/docs/technical-reference/prismicio-react?version=v2#slicezone)**
>
> @prismicio/react is the official Prismic package for creating web apps with Prismic and React.

---

<div class="post-metadata">

**Author:** ![constructivearchitec](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@constructivearchitec](https://community.prismic.io/u/constructivearchitec)\
**Post date:** [July 3, 2023, 4:06pm UTC](https://community.prismic.io/t/unsure-how-sliceprops-works/13547/8 "2023-07-03T16:06:39Z")

</div>

Perfect, thanks. I tried this and was able to get the `context` data within my slices.

```auto
const TextBlock = ({ slice, context }) => {
  console.log({ context });

```
