React.PropTypes validation warning
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!
Something outside of react-redux is calling proptype validation. We don't do that internally.
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.
@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.
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.
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)
...
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.
@gaearon have the same issue with [email protected] and [email protected]
That was specifically fixed in 5.0.4 (see #663). Something else must be triggering it.
@denieler Please provide a minimal project reproducing it and I can take a look.
@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.
@gaearon I've investigated it a little bit and it seems that happening only when process.env.NODE_ENV: "production"
@timdorr maybe you have your comment how it can be fixed in this conditions?
We need a more complete example. Can you share your whole repo? Just that code snippet by itself doesn't really tell us anything.
@timdorr sorry, created clean project and seems it works