我对React服务器端渲染还不太熟悉,在使用React、Redux、React Router和Material UI开发小型演示时,遇到了以下问题:不确定同构样式和资源是如何与Webpack一起工作的。
请您纠正我如果以下管道的服务器端渲染工作方式有误:
- 使用renderToString将React组件解析为HTML。
- 在客户端上呈现HTML后,所有事件和样式都被附加,这意味着React会尝试在客户端上再次呈现组件,如果组件已经创建,则会再次创建它。
- 检查和判断组件是否已经创建是基于校验和的。
请参阅Git中报告的问题 https://github.com/callemall/material-ui/issues/4466
代码 https://github.com/sabha/React-Redux-Router-MaterialUI-ServerSideRendering
'warning.js:44Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server: (client) 0;text-align:center;mui-prepared:;-webki (server) 0;text-align:center;-webkit-user-select:'