首页 > react 在服务端渲染 使用material-ui Warning

react 在服务端渲染 使用material-ui Warning

在 react 构建项目的时候 使用了 服务端渲染
当加入了 material-ui 的时候 出现了 Warning

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) tyle="did-flip:true;-webkit-tap-highligh
(server) tyle="did-flip:true;tap-highlight-color:

 material-ui 

<TextField
  style={styles.textfield}
  hintText="用户名"
  underlineFocusStyle={{borderColor: Colors.amber900}}
  defaultValue="" /><br/>
<TextField
  hintText="密码"
  floatingLabelText="Password"
  type="password" /><br/>
<RaisedButton
   style={styles.textfield}
   label="登录" secondary={true} /><br/>

    global.navigator.userAgent = req.headers['user-agent']

autoprefixer需要设置ua来编译对应的前缀

参考:
http://www.material-ui.com/#/get-started/server-rendering

【热门文章】
【热门文章】