Creating table with Rich Text field

Hi,

At the moment I'm creating a website with Prismic and a Gatsby-frontend. In Prismic I've set up a RichText field to insert custom HTML-code. With GraphQl im querying this field as text. This works all fine, but on the website it's displaying the plain HTML-code instead of the result of the HTML.
That's my Gatsby code for this part of the website:


Where is the mistake?

Thanks in advance for your help!

Don’t you need to use dangerouslySetInnerHTML?

<React.Fragment key={i}>
  {RichText.render(content.headline.raw}
  {RichText.render(content.text.raw}
  <div dangerouslySetInnerHTML={{__html: content.custom_html.text}} />
</React.Fragment>
1 Like

Perfect, that’s how it works.

Thank you @marcellothearcane !

1 Like