Skip to content

React.PropTypes validation warning #484

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

Closed
luckydrq opened this issue Sep 7, 2016 · 14 comments
Closed

React.PropTypes validation warning #484

luckydrq opened this issue Sep 7, 2016 · 14 comments

Comments

@luckydrq
Copy link

luckydrq commented Sep 7, 2016

I have [email protected] and [email protected] in my project and got the following warning:

warning.js:36 Warning: You are manually calling a React.PropTypes validation function for the `store` prop on `Connect(ToolboxContainer)`. 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.js:36 Warning: You are manually calling a React.PropTypes validation function for the `store` prop on `Provider`. 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.js:36 Warning: You are manually calling a React.PropTypes validation function for the `children` prop on `Provider`. 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.js:36 Warning: You are manually calling a React.PropTypes validation function for the `actions` prop on `ToolboxContainer`. 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.

How to avoid these warnings? I've read this guide but still have no idea. Not sure if it is emitted by react-redux's storeShape. Please point out if i'm wrong, thanks!

@timdorr
Copy link
Member

timdorr commented Sep 7, 2016

Something outside of react-redux is calling proptype validation. We don't do that internally.

@timdorr timdorr closed this as completed Sep 7, 2016
@luckydrq
Copy link
Author

luckydrq commented Sep 8, 2016

Thank you for your reply! I've found the reason. I have another react version(15.1.0) which used as a dependency, when i upgrade it to 15.3.1 the warnings disappear.

@actionnick
Copy link

@timdorr

I am seeing this error on [email protected] and [email protected].

It does seem like here you are calling a validator function which according to this would result in a warning or error being thrown.

@gaearon
Copy link
Contributor

gaearon commented Apr 13, 2017

No, calling shape() is fine (because it returns a validator, and calling that would throw).

Have you updated to [email protected]? Seems like it fixes the deprecation warnings: https://github.com./reactjs/react-redux/releases/tag/v5.0.4.

@actionnick
Copy link

Tried updating the 5.0.4 and still seeing the warning.

Really seems like react-redux is generating the warning. Stack trace looks something like...

Warning: Failed prop type: 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
    in Connect(Component) (created by OtherComponent)
    in OtherComponent (created by SomeOtherComponent)
    ...

@gaearon
Copy link
Contributor

gaearon commented Apr 13, 2017

Are you sure you don't have older versions of React somewhere in the tree?
Please run npm ls react and paste the results.

The reason I’m asking: https://github.com./reactjs/prop-types#compatibility.

@denieler
Copy link

@gaearon have the same issue with [email protected] and [email protected]

@timdorr
Copy link
Member

timdorr commented Apr 25, 2017

That was specifically fixed in 5.0.4 (see #663). Something else must be triggering it.

@gaearon
Copy link
Contributor

gaearon commented Apr 25, 2017

@denieler Please provide a minimal project reproducing it and I can take a look.

@denieler
Copy link

@gaearon nothing special, I just add Provider and build the script. In app.js file I have next:

import React, {Component} from 'react'
import { Provider } from 'react-redux'

export class App extends Component {
  render () {
    const store = {}

    return (
      <Provider store={store}>
          <span>Hello World!</span>
      </Provider>
    )
  }
}

And it doesn't show warnings in webpack-dev-server mode, but when I built it and mounted as a library - it does.

@denieler
Copy link

@gaearon I've investigated it a little bit and it seems that happening only when process.env.NODE_ENV: "production"

@denieler
Copy link

@timdorr maybe you have your comment how it can be fixed in this conditions?

@timdorr
Copy link
Member

timdorr commented Apr 26, 2017

We need a more complete example. Can you share your whole repo? Just that code snippet by itself doesn't really tell us anything.

@denieler
Copy link

@timdorr sorry, created clean project and seems it works

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

5 participants