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: