Customizing RichText Components and PrismicNextLink

I have a question regarding customization of Prismic components.

A few month ago the starter tutorial for Next.js suggested to use the <PrismicProvider> component.
This gave me the option to customize the <PrismicLink> component and set custom components which are used by <PrismicRichText> all over the application.

<PrismicProvider
  internalLinkComponent={(props) => <Link {...props} />}
  externalLinkComponent={(props) => <Link {...props} external />}
  richTextComponents={{
    heading1: ({ children }) => <Title level="h1">{children}</Title>,
    heading2: ({ children }) => <Title level="h2">{children}</Title>,
    heading3: ({ children }) => <Title level="h3">{children}</Title>,
    heading4: ({ children }) => <Title level="h4">{children}</Title>,
    heading5: ({ children }) => <Title level="h5">{children}</Title>,
    heading6: ({ children }) => <Title level="h6">{children}</Title>,
    paragraph: ({ children }) => <Text>{children}</Text>,
    strong: ({ children }) => <TextStrong>{children}</TextStrong>,
  }}>

As mentioned now, it's no longer recommended to use the <PrismicProvider> component:

We no longer recommend using <PrismicProvider>
We recommend creating your own wrapper components to configure components globally rather than using <PrismicProvider>.

So, how am I able to customize the components, that are used in my <PrismicRichText> globally?

And how can I customize the components, that are used by the newly implemented <PrismicNextLink> component?

I would highly appreciate those possibilities.

Hello Andre,

Thanks for reaching out to us.

Indeed, We don't recommend <PrismicProvider> anymore because <PrismicProvider> isn't compatible with React server components, and React server components are far more performant.

You can create your own wrapper component to do this. The React technical reference has code snippets for this.
For PrismicRichText, the paragraph starting: To globally customize <PrismicRichText>.
For PrismicLink, the paragraph starting: To globally customize <PrismicLink>.

I hope it's clear to you. Let me know if you need any assistance.

Thanks,
Priyanka

Thanks for your reply, @Priyanka!

I'm sorry, I didn't see that part of the documentation and somehow I didn't think as far on my own... :man_facepalming:
I'll update my applications. :slight_smile:

No issues, @andre.lergier. I am happy to answer you. Let us know if you need any assitance.