skip to Main Content

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.

3

Answers


  1. Chosen as BEST ANSWER

    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


  2. React seems suitable with Node Js (only). But, You can try to solve your problem with use this Laravel Plugin.
    react-laravel

    Login or Signup to reply.
  3. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search