I'm sending a client a loader, and I want to receive my main React.js components from the server, after rendering the loader.
I'm using node.js with express on the backend and i'm using the "express-react-views" engine for rendering.
So, how can I safely transfer components from the server to the client?
Thanks a lot.
var htmlOfComponent = ReactDOMServer.renderToString(component);
send this htmlOfComponent as part of your initial html page request from server.
include react.js in script tags and send.
For component data=> you can send that stringified in script tags too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.