MAXIMUM use of ReactJS in plugins?

We’re making heavy WordPress Admin Plugins with frontends.

Setting the stage-
Myself and 3 developers on my team are ReactJS + SolidJS nerds or to be more honest, freaks. We have very little love for PHP and the knowledge to match.

Can anyone elaborate on their own experience with using ReactJS or even RUST as the primary language? So like calling reactjs app from the DOM in WordPress Administration.

I used this as a guide to get started. But I am wondering about various experience rants, stories, risks, opportunities, etc.

Thanks Gang :slight_smile:

Hi @sacredtexts,

Using ReactJS to implement an interface for an admin-side plugin can be a good approach, and is nothing special or unusual. In fact, the block editor (Gutenberg) is a React application.

Regarding Rust - I assume you’re talking about Rust → WASM (like Yew)? I’d be hesitant to start out on a production level project using an immature stack, but there’s no reason I can see that it wouldn’t work.

The WordPress admin UI is (for the most part) HTML and a sprinkle of React, so you can make most JS frontends work. WP provides a useful REST API, which is extensible, so you can persist data / communicate with the core.

The article you linked has some good info, but reaching for React on the frontend of a site just because you don’t like WordPress / PHP isn’t a good reason in my view. It’s a DX vs client experience tradeoff that I wouldn’t make. Building an admin UI, now that’s a different story.

A quick search has thrown up this (old) repo, which gives what appears to be a good example of how to enqueue and mount a React app inside WP Admin. Note how the assets are enqueued only on the admin interface.

I’m sure I’d agree with you on a lot of the criticisms of PHP (Rust has spoilt us), but it’s 100% worth your team’s time to dive in and make sure you’ve grok’d the WordPress API, and know how to write decent PHP (dependency management, basics)

1 Like