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!
Top comments (8)
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/...
Thank you so much for this info!
Use next.js instead?
but thank you for your help!
well that's a node.js middleware if we want WordPress to be the backend...
May be I'm too late to reply. Next.js is a good solution. Use Wordpress Rest api with next.js.
I'm doing it here: craftcode.design/
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!