Gatsby & WordPress - 3.4.5. - Render HTML Strings as Elements
Hey! Just so you know, this article is over 2 years old. Some of the information in it might be outdated, so take it with a grain of salt. I'm not saying it's not worth a read, but don't take everything in it as gospel. If you're curious about something, it never hurts to double-check with a more up-to-date source!
When working with our WordPress GraphQL schema we will often encounter the issue of having to render an HTML string as HTML elements within our React application.
Instead of using the unpreferred method of setting the HTML string as innerHTML dangerously, we will parse the HTML string and detect for any relative anchor tags. Replacing those instances with the Gatsby 'link' component.