aickin / react-dom-stream

A streaming server-side rendering library for React.
2.01k stars 48 forks source link

You are manually calling a React.PropTypes validation function #22

Open lalayueh opened 8 years ago

lalayueh commented 8 years ago

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 head prop on Html. 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 the content prop on Html. 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.

maxpain commented 8 years ago

+1

chenjia2015 commented 8 years ago

+1

pasiba commented 8 years ago

Same.

Alex-ray commented 8 years ago

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).

jedwards1211 commented 7 years ago

There must be some good reason for this...surely they knew this would ruin SSR?

nim23 commented 7 years ago

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.

GuillaumeCisco commented 6 years ago

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 ?

hakimelek commented 6 years ago

Any updates on this?

lalayueh commented 6 years ago

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