You are manually calling a React.PropTypes validation function
After upgrading react to 15.3.0, it shows the following warning message via the server side rendering:
Warning: You are manually calling a React.PropTypes validation function for the
headprop onHtml. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details. Warning: You are manually calling a React.PropTypes validation function for thecontentprop onHtml. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.
I think it may call PropTypes directly within the call path of renderToStaticMarkup The issue can be reproduced by the following code:
function renderComponent({ componentHtml, head }) {
return renderToStaticMarkup(
<Html
content={componentHtml}
head={head}
/>
);
}
Could you kindly help this issue. Thanks.
+1
+1
Same.
Yup this is a pretty big issue because
If you don't fix the warning, this code will crash in production with React 16.
They even suggest an alternative.
If you depend on using PropTypes like this, we encourage you to use or create a fork of PropTypes (such as these two packages).
There must be some good reason for this...surely they knew this would ruin SSR?
I was looking into this just to realise that react-dom-stream relies on a forked version of react which is on react 0.14.2. Between that and react 15.3.0 I am lost as to where to look for solution for the validation warning's.
Just run into a new issue by using ReactDOMStream:
Warning: Failed Context Types: Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types
Looks like the change is not too hard ?
Any updates on this?
If you are using react 16, it seems to me that you should better use the renderToNodeStream method from ReactDOMServer to fix this issue.
Reference: https://reactjs.org/docs/react-dom-server.html#rendertonodestream