# React PrismicLink component causing error when not set (on local dev environment)

**URL:** <https://community.prismic.io/t/react-prismiclink-component-causing-error-when-not-set-on-local-dev-environment/10270>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [June 9, 2022, 7:15pm UTC](https://community.prismic.io/t/react-prismiclink-component-causing-error-when-not-set-on-local-dev-environment/10270 "2022-06-09T19:15:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![moorenmike](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@moorenmike](https://community.prismic.io/u/moorenmike)\
**Post date:** [June 9, 2022, 7:15pm UTC](https://community.prismic.io/t/react-prismiclink-component-causing-error-when-not-set-on-local-dev-environment/10270/1 "2022-06-09T19:15:20Z")

</div>

I am using Prismic in combination with Next.js to build a marketing website.

After making some changes to the content from the Prismic UI, I encountered some problems on my development environment.

I have a slice with a title, description, ctaUrl, ctaLabel and image.  
After updating the content I am getting the following error:

> [PrismicLink] This "field" prop value caused an error to be thrown.  
> { link\_type: 'Any' }  
> Error: [PrismicLink] The provided field is missing required properties to properly render a link. The link may not render. For more details, see [https://prismic.dev/msg/react/v2.4.1/missing-link-properties](https://prismic.dev/msg/react/v2.4.1/missing-link-properties)

The strange thing is that his only happens locally and not after building the site on vercel, which looks at the same data source.

The error doesn't occur when I remove the link from the slice.

When looking at the response from the query to Prismic I am getting back the link\_type: 'Any' for empty links. It seems like the component is expecting more, which is not available due to the empty link field.

```auto
PAGE.data.slices[1].primary.ctaUrl { link_type: 'Any' }
PAGE.data.slices[2].primary.ctaUrl { link_type: 'Any' }
PAGE.data.slices[3].primary.ctaUrl { link_type: 'Any' }
PAGE.data.slices[4].primary {
  title: [
    {
      type: 'heading1',
      text: 'Title text',
      spans: []
    }
  ],
  description: [],
  link: {
    id: 'YnGv_hcAACkAatST',
    type: 'page',
    tags: [],
    lang: 'nl-nl',
    slug: 'time-to-get-in-touch',
    first_publication_date: '2022-05-03T22:44:26+0000',
    last_publication_date: '2022-06-07T11:05:05+0000',
    uid: 'contact',
    url: '/contact',
    link_type: 'Document',
    isBroken: false
  },
  linkLabel: 'Contact us',
  image: {
    dimensions: { width: 1925, height: 1025 },
    alt: null,
    copyright: null,
    url: 'https://images.prismic.io/tiny/..............jpeg?auto=compress,format'
  }
}

```

In the slice I was previously checking if the link is available by checking for the entire field:

```auto
{slice?.primary?.ctaUrl && (
  <PrismicLink
    field={slice.primary.ctaUrl}
    className="inline-flex rounded-md border border-transparent bg-sg-grey-2 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-sg-grey-4"
  >
    {slice.primary.ctaLabel}
  </PrismicLink>
)}

```

However, as a workaround I need to check if the url on the field exists, as this is available for document, media or web links.

```auto
{slice?.primary?.ctaUrl?.url && (
  <PrismicLink
    field={slice.primary.ctaUrl}
    className="inline-flex rounded-md border border-transparent bg-sg-grey-2 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-sg-grey-4"
  >
    {slice.primary.ctaLabel}
  </PrismicLink>
)}

```

Is this something on purpose, or did something on my environment change for this to happen?

---

<div class="post-metadata">

**Author:** ![kris](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@kris](https://community.prismic.io/u/kris)\
**Post date:** [June 9, 2022, 10:45pm UTC](https://community.prismic.io/t/react-prismiclink-component-causing-error-when-not-set-on-local-dev-environment/10270/2 "2022-06-09T22:45:37Z")

</div>

Related discussion on Github - [PrismicLink output if not enough attributes are passed in · Issue #150 · prismicio/prismic-react · GitHub](https://github.com/prismicio/prismic-react/issues/150)

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [June 10, 2022, 10:29am UTC](https://community.prismic.io/t/react-prismiclink-component-causing-error-when-not-set-on-local-dev-environment/10270/4 "2022-06-10T10:29:03Z")

</div>

Hello @moorenmike

It seems the issue has been merged and published in `@prismicio/react@v2.4.2`.To update, install the latest version:

```auto

npm install @prismicio/react@latest

```

Could you update and let us know if it fixes the issue?

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![moorenmike](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@moorenmike](https://community.prismic.io/u/moorenmike)\
**Post date:** [June 15, 2022, 6:29pm UTC](https://community.prismic.io/t/react-prismiclink-component-causing-error-when-not-set-on-local-dev-environment/10270/5 "2022-06-15T18:29:59Z")

</div>

Hi @Priyanka ,

Thanks for your reply.  
It looks like the issue that causes the page to crash has been resolved.  
The error still appears in the console though:

```auto
[PrismicLink] The provided field is missing required properties to properly render a link. The link may not render correctly. For more details, see https://prismic.dev/msg/react/v2.4.2/missing-link-properties { link_type: 'Any' }

```

Cheers,  
Mike

---

<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 22, 2022, 11:50am UTC](https://community.prismic.io/t/react-prismiclink-component-causing-error-when-not-set-on-local-dev-environment/10270/7 "2022-06-22T11:50:27Z")

</div>

@moorenmike I'm not sure why you're still seeing this warning if the error isn't there. I'll send this to the dev team so they can take a look
