Pros and cons of using Gatsby in WordPress projects
The combination of Gatsby and WordPress has become a very hot topic this year.
Thanks to a number of business benefits, more and more companies are adopting Gatsby, which is also making React and Gatsby developers highly sought after.
Since WordPress is one of the most popular CMSs and website builders, the rise of Gatsby has prompted a question in the content world: "Is Gatsby better or worse than WordPress?"
But my question is rather: "Does it need to be better or worse than WordPress?"
What if both technologies could work together and combine the best of each?
Does this relationship make sense?
Why use Gatsby with WordPress?
1. Modern performance

Using Gatsby for development means harnessing all the benefits of React and GraphQL — the most cutting-edge modern front-end libraries.
It opens up many possibilities for creating a truly exceptional and fully customised user experience, with superior website performance and increased speed.
GatsbyJS is a static PWA generator. Once loaded, Gatsby pre-fetches resources for other pages, making navigation across the site incredibly fast.
2. Security

When it comes to security, WordPress has a great deal of ground to make up — and this is where Gatsby steps in as the hero.
Again, static site generators are extremely secure because there is no direct connection to the database, dependencies, user data, or other sensitive information.
3. No plug-ins required

From a non-developer's perspective, WordPress is the more natural choice because it is fairly easy to use.
If the work involved is limited to a few simple tasks, such as editing content or making minor layout changes, they can easily manage these themselves without the help of a developer.
However, if a non-developer wants to adopt custom features, they are entirely dependent on WordPress plugins, which severely limits the user experience and scope for customisation. To get what they want, they simply add plugin after plugin.
What they often don't realise is that running each plugin is equivalent to loading an additional library.
So, by using too many plugins and letting them accumulate, they make their website extremely heavy and difficult to render. It ultimately becomes VERY SLOW.
4. Development enjoyment

Gatsby opens up many technological possibilities that can be highly beneficial for a project.
The developer has more freedom in choosing tools, which allows them to create a truly personalised and exceptional user and development experience.
5. Your content is already there

If you are considering migrating to take advantage of new technologies and do more, you don't need to worry about your existing content.
With Gatsby, there is no need to migrate content, because it is already there, in your WordPress CMS.
6. Other reasons to use Gatsby with WordPress:
-
Easy-to-manage and widely familiar WordPress admin panel
-
Ready-to-use user connection and authorisation system
-
A highly developed yet easily customisable WordPress API
-
With Gatsby and Gutenberg (the new editor), you can create a drag-and-drop Gatsby site builder
-
Reduced hosting costs
Why not use Gatsby with WordPress?
Like any relationship, this one has its problems too.
Most importantly, WordPress is a blogging platform and does not always sit comfortably as a headless back end, primarily because it still uses "older" technologies such as PHP and is slower than other back-end platforms such as Strapi or Contentful.
Let's explore further.
1. New knowledge is required

If you want to work with Gatsby and WordPress simultaneously, you ultimately need to be well versed in both PHP and JavaScript.
Gatsby is also a blend of React and GraphQL, so these must be known too.
However, from another perspective, it is an excellent opportunity to start thinking reactively and broaden your development horizons.
Learning React and GraphQL can also seem like a great idea, as both technologies are reaping the rewards of the tech boom and are likely to remain on the top shelf for a while longer.
That said, as we mentioned earlier — non-developers will hate it. Or more simply, they will be unable to act.
2. Loss of many WordPress capabilities and features

By blending Gatsby with WordPress, WP becomes back-end only, which means we lose many of its features and capabilities.
For example, you cannot use theme Hooks.
WooCommerce, for instance, uses native WP hooks but is also capable of adding its own hooks, allowing it to customise many actions — in fact, you can step into any phase of an order and modify it, or change the action entirely (such as the payment stage).
To make this possible with Gatsby, you have to write the connection to the API from scratch.
Another consideration: plugins.
If you want a plugin to work correctly, you need to programme it yourself using its API. The problem is that not all plugins share their API, which means you will be unable to make it compatible.
3. Content changes

As already noted, Gatsby is a static site generator, meaning it cannot be "simply edited" — and any change (even a small text amendment) will require a new deployment.
So if you have a page that requires many daily content changes, you may find this approach both time-consuming and frustrating.
Furthermore, if your content is distributed across many channels and has its own specific, highly rigid data model, Gatsby may not be able to handle it correctly.
In conclusion
Combining Gatsby with WordPress is a relatively recent topic (or at least one that has been refreshed of late), and I expect the number of initiatives around it will only grow.
Gatsby is one of the most talked-about technologies at the moment, and just like React and GraphQL, it is gathering an ever-growing fan base.
Yet we must always remember that WordPress powers 35% of the internet and is certainly not about to stop in its tracks.
This is also why many new technologies are working to find ways for different solutions to work together.
The future looks interesting, but as ever — let's see what happens.
Have a similar project?
Let's talk it over in 15 minutes. No sales pitch, just a technical chat.
