Isomorphic React.js with PHP server-side rendering

8 Views
45ghesgd1
0
Published on 24 Jun 2018 / In PHP

Learn how to develop isomorphic React.js applications using a PHP backend. This tutorial is especially handy for those developing React.js apps wanting to do server-side rendering, but without using Node.js or Express.js.

What you'll want to do is:

1. Install V8Js PHP extension
2. Make sure your React app takes its initial input as props
3. Set up a router that uses HTML5's window.history.pushState()
4. Redirect all PHP traffic within your application so it all goes through a single entry point (front controller pattern)
5. Fetch the data needed for a given route
6. Render your React components in PHP using V8Js and React's renderToString()
7. Render your component's bootstrap using the server-fetched data

Source code: https://github.com/formigone/e....asylearntutorial/tre

V8Js: https://github.com/phpv8/v8js

Programming tutorials by Easy Learn Tutorial - because anyone can learn how to become an expert software and web developer!

Copyright (c) 2013 Rodrigo Silveira - http://www.easylearntutorial.com

Show more
0 Comments sort Sort by