DEV Community

Rehan Hassan
Rehan Hassan

Posted on

Run React build inside PHP

Hi there!

I have created a very simple two pages SPA using React 18 & Vite. One page is Listview containing list items and the other page is a DetilView to show the details of the selected item.

I have deployed my react build to a server already, but instead of serving my app directly, I want to render my app inside PHP, I want to use PHP for SEO (can't use Next.js or any other SSR frameworks).

I want to achieve both SSR + SPA behavior with using PHP + React
Check below image, that's how I'm trying to do it. Icon & Titles are being loaded but whole page is empty even though React is being rendered!

Any help would be apricated!

Image description

Image description

Top comments (0)