4
4
4ch232019-06-30 21:48:26
PHP
4ch23, 2019-06-30 21:48:26

What is the best way to organize prerendering in react and php?

The task is to develop a public application on React. Given that this is react, all page content will be generated by javascript.
What are the solutions for automatic prerendering of html pages based on react routes?
In theory, I see it like this:
The client makes a request to /contacts/. There, he is shown a pre-generated (during the next build of JS) contacts.html in which there is
After loading bundle.js, the client renders a react application, everyone is happy - search robots, the client, and site owners.
The key point is that after each new build of JS, it would be easy and simple to re-render all *.html
Backend to PHP.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Derepko, 2019-06-30
@xEpozZ

npm build
This should launch something from WebPack/Gulp/Grunt/etc., which in turn will make the entire build in the desired directory (dist, build - standard folder names. configured in configs)
After that, you will have all the JS in one or more files and several End points (index.html, contacts.html, ...)
What is the question?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question