React-redux: 4.4.8 throws PropTypes validation warnings for React 14

Created on 12 Apr 2017  路  8Comments  路  Source: reduxjs/react-redux

For every component we use 'connect' in, we get the following JS warning on every render:

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 Check the render method of `[NAME OF COMPONENT]`

Right now, each page load brings about 2000 of these warnings.

For example, using the following component throws warnings:

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

class FeedCard extends Component {
  render() {
   return <div />
  }
}

export default connect(null, {
  updateFeedItem,
})(FeedCard)

But simply removing the 'connect' usage "fixes" the problem (although it renders the component useless):

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

class FeedCard extends Component {
  render() {
   return <div />
  }
}

export default FeedCard

I confirmed that downgrading to 4.4.7 makes the issue go away.
We are using React 0.14.8

Most helpful comment

Okay, [email protected] and [email protected] are out, and they should play nice with prop-types. Other React-related packages were not updated. Let me know if it helps.

All 8 comments

@gaearon So, is prop-types not compatible with 0.14 then? 馃槃

I have this problem too.
React 0.14.8 and react-redux 4.4.8.

Okay, this one is hard.. Let me think on it.

The problem is technically those warnings were introduced in React 15. And prop-types was extracted from React 15. So by migrating the library to use them you鈥檙e kind of opting into seeing those warnings.

But in this case they鈥檙e not actionable because they鈥檙e coming from React itself. 馃槥

I'm going to try to cut prop-types-compatible 0.14.9 which is the real fix here.

Okay, [email protected] and [email protected] are out, and they should play nice with prop-types. Other React-related packages were not updated. Let me know if it helps.

I also cut [email protected] which only prints the warning 3 times at most (so that even a false positive with react < 0.14.9 is less annoying).


Look at Dan go!

Looks like the issue is upstream with React itself, so I'm closing this one out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cpprookie picture cpprookie  路  3Comments

winterbe picture winterbe  路  3Comments

esayemm picture esayemm  路  3Comments

nainardev picture nainardev  路  3Comments

sajaddp picture sajaddp  路  3Comments