Insights

Gatsby & WordPress – 3.4.5. – Render HTML Strings as Elements

13/11/2019 by Jack Pritchard

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.

Continue Reading 📚