React SSR with PHP and WordPress

github logo ・1 min read

I am looking for a solution that use React for the font-end and WordPress for the backend with the following requirements:

  • No static rendering at build time:
    • Was actually thinking Gatsby or React Static at first, but it requires not to re-build every time the content updates
  • No node.js middleware:
    • Cannot add a middleware to call the WordPress api and then render React
  • No classic SPA:
    • For SEO and performance considerations, we want not just a blank page coming back from the response

A potential solution we're looking at is to use Gatsby or React Static to build and then use PHP to update the generated HTML and JSON with the latest content, which isn't really an ideal solution in my opinion; so reaching out to see if there's any other solutions.

Thanks a lot!

twitter logo DISCUSS (7)
markdown guide
 

Hmm, you’re kind of crippling yourself here because React and Nodejs play great with each other.

There are other methods to do SSR with php but I would call them kind of hacky

github.com/reactjs/react-php-v8js/...

 
 
 

If you don't want a SPA and also you don't want client side render, why would you choose react?
Have you thought about using other front-end technology?

 

well React is what the team is good at and used to, and I don't think we would move away from it...
and also I wouldn't say React is just for client-side SPA even though that's what a big portion of the people are using it for.
moreover, I think we are still aiming for a SPA, what I meant is just not the classic SPAs where you get a blank page as a response no matter the routes,.
but really appreciate you helping! thanks a lot!

Classic DEV Post from Dec 15 '18

The new MacBook Pros are overpriced

I've been a Mac user for over a decade but I'm lacking enthusiasm towards the r...

Wenchen Li (Neo) profile image
Making fancy and novel web stuff 🀯

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❀️