Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lalayueh opened this issue Aug 3, 2016 · 9 comments
Open

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

lalayueh opened this issue Aug 3, 2016 · 9 comments

Comments

@lalayueh
Copy link

lalayueh commented Aug 3, 2016

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
Copy link

maxpain commented Aug 13, 2016

+1

1 similar comment
@chenjia2015
Copy link

+1

@pasiba
Copy link

pasiba commented Aug 28, 2016

Same.

@Alex-ray
Copy link

Alex-ray commented Sep 7, 2016

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
Copy link

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

@nim23
Copy link

nim23 commented Sep 18, 2016

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
Copy link

GuillaumeCisco commented Sep 25, 2017

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
Copy link

Any updates on this?

@lalayueh
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants