Gatsby is a static site generator with generic data sources. That’s also what makes it special. You can plug in a wide variety of data sources into Gatsby and it will generate static pages out of that. You can use anything from CSV or markdown files to a WordPress installation as a backend.
Preact is a faster and smaller alternative to React and I have come to like it for building interactive components into WordPress themes and plugins. In this post we’ll go through how to write a Preact Component and how to inject it into an existing WordPress theme.
On my blog, at the time of writing, I’m using the twentysixteen theme with a few minor changes, one of those is the related posts that show up at the bottom of each blog post, which is a tiny plugin exposing an API and rendering through Preact.
If you’re used to React, you’ll feel right at home with Preact straight away.
This is what my related posts plugin looks like at the moment:
If you want to set up a quick demo project with React Fiber you can use the create-react-app way and simply: