I'm Getting the error in browser-console
Uncaught TypeError: Cannot read property 'func' of undefined
on following line(in bundled js file)
ChannelForm.propTypes = {
addChannel: _react2['default'].PropTypes.func.isRequired
};
my code looks like this where i'm getting this error
ChannelForm.propTypes={
addChannel: React.PropTypes.func.isRequired
}
Everything seems to be fine. I can't figure out what's wrong here.
As says in the react documentation
React.PropTypes has moved into a different package since React v15.5. Please use the prop-types library instead.
so you need to import it first like :
import PropTypes from 'prop-types';
and then use it where ever you will require propTypes like this (You can modify it accordingly)
propTypes = {
name: PropTypes.string
};
You can read more about it here
React.PropTypes
no longer works. According to react docs,
React.PropTypes has moved into a different package since React v15.5. Please use the prop-types library instead.
So you have to import PropTypes
from the prop-types
package rather, and then instead of writing React.PropTypes.func.isRequired
try PropTypes.func.isRequired
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With