React 16: Warning: Expected server HTML to contain a matching
in <body>

前端 未结 8 2295
太阳男子
太阳男子 2020-12-17 08:37

Since upgrading to React 16 I get this error message:

warning.js:33 Warning: Expected server HTML to contain a matching

in .

8条回答
  •  余生分开走
    2020-12-17 09:23

    I'm assuming you are using ssr. The warning is about attempting to render before there is a window object. You need to hydrate.

    ReactDOM.hydrate(, document.getElementById("home"))
    

    What I don't understand, is that the App component is being served static by express. Why is it trying to render before it is served? Bring on the comments.

提交回复
热议问题