Search code examples
reactjsreact-proptypes

Uncaught TypeError: Cannot read property 'oneOf' of undefined


I am migrating my React project from v15 to v16. While doing that I am facing below error

Uncaught TypeError: Cannot read property 'oneOf' of undefined

complete error below:

Uncaught TypeError: Cannot read property 'oneOf' of undefined
at Object.eval (alert.js?b73b:1209)
at __webpack_require__ (alert.js?b73b:30)
at Object.eval (alert.js?b73b:472)
at Object.eval (alert.js?b73b:751)
at __webpack_require__ (alert.js?b73b:30)
at Object.eval (alert.js?b73b:81)
at __webpack_require__ (alert.js?b73b:30)
at Object.eval (alert.js?b73b:57)
at __webpack_require__ (alert.js?b73b:30)
at eval (alert.js?b73b:50)

After doing research in internet I found that the issue is something related to prop-types but not sure what I have to do to fix this issue. I am using prop types version "prop-types": "^15.6.0".


Solution

  • I am able to resolve the issue. Since I upgraded to react v15 to v16 the issue was with react-alert module as I was using react-alert v1. So upgrading it to react-alert v4 resolved issue for me.