react-redux icon indicating copy to clipboard operation
react-redux copied to clipboard

React.PropTypes validation warning

Open luckydrq opened this issue 10 years ago • 14 comments

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!

luckydrq avatar Sep 07 '16 06:09 luckydrq

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

timdorr avatar Sep 07 '16 16:09 timdorr

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.

luckydrq avatar Sep 08 '16 02:09 luckydrq

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

actionnick avatar Apr 13 '17 17:04 actionnick

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.

gaearon avatar Apr 13 '17 17:04 gaearon

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

actionnick avatar Apr 13 '17 18:04 actionnick

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 avatar Apr 13 '17 19:04 gaearon

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

denieler avatar Apr 24 '17 21:04 denieler

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

timdorr avatar Apr 25 '17 00:04 timdorr

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

gaearon avatar Apr 25 '17 09:04 gaearon

@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 avatar Apr 25 '17 16:04 denieler

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

denieler avatar Apr 25 '17 17:04 denieler

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

denieler avatar Apr 26 '17 12:04 denieler

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 avatar Apr 26 '17 17:04 timdorr

@timdorr sorry, created clean project and seems it works

denieler avatar Apr 26 '17 17:04 denieler