流量路由器SSR,流星和材料UI

问题描述:

林流星1.4和材料UI反应并即时得到这个错误流量路由器SSR,流星和材料UI

warning.js:36 Warning: 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) ;width:100%;display:flex;padding-left:24 (server) ;width:100%;display:-webkit-box,-moz-box

我该如何解决这个问题?

请参见:this issue was discussed here

您需要在客户端和服务器上使用相同的process.env.NODE_ENV

解决方法:使用的WebPack(或browserify):

new webpack.DefinePlugin({ 
process: { 
    env: { 
     NODE_ENV: JSON.stringify(process.env.NODE_ENV) 
    } 
}}) 

欲了解更多信息:http://www.material-ui.com/#/get-started/server-rendering

您需要找到什么使服务器呈现与客户端不同的内容。我猜在material-ui中,就像某些功能的浏览器开关一样。一旦你找到了,我可以帮助更多。