We are setting an app using Laravel in backend and React.JS + Redux in front end. So looking for solution for server side rendering (for SEO).
Found this solution: https://github.com/tz5514/Laravel-Redux-Isomorphic but it seems like in backend it using express.js to render.
So I am searching for any better server side rendering solution.
React is javascript, so it needs a javascript engine in order to run, so one way to see a laravel project is to think of it as the 'backend' api server, which is completely separated from the 'frontend' server which uses node to run the javascript part of the application.
In other words, you have two apps, the one with laravel that exposes an api which could be used by any other service in the infrastructure, and the reactjs app which is a nodejs app that consumes that api, and handles the magic of react + redux.
The way your site is actually accessed from the outside world is thru the express/nodejs app, which calls the laravel api for data persistence and other business logic.
The laravel app handles sessions, oauth, the database, file access to the hardrive and so on, while the nodejs app handles the actual website routing, the templates, the css and javascript part.
I got this answer from HashNode
you can use the spatie/laravel-server-side-rendering package, it is great for both React & Vue. Here you can find YT tutorial for this package usage as well - https://youtu.be/uO42Kpa4pvI
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With