I am getting warning as" Warning: Failed prop type: Component: prop type props is invalid; it must be a function, usually from the prop-types package, but received object"
my code is:
const { history } = props.props
history.push('/next');
Component.propTypes = {
props: {
history: PropTypes.object,
},
}
Component.defaultProps = {
props: {
history: PropTypes.object,
},
}
My functionality working fine but getting this console error Can someone help me to resolve this warning?
You're using the value {} for props in propTypes, that's not allowed. You want shape:
Component.propTypes = {
props: PropTypes.shape({
history: PropTypes.object,
}),
}
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