0
votes

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

1
show your code, not just your error please. - Chris
At least show the code related to oneOf - Isaac
When you have this kind of problems remember that migrating a project changing the React version need to update even all other dependencies. So update all your dependencies (some dep could use React 15 and now you want the same dep with React 16). Import the PropTypes from "prop-types" when you need them. - Paolo Dell'Aguzzo
I don't no where exactly it causes oneOf issue. Not sure which part of code do I need to share and that's why I have provided only error details. Let me know which part of code Do I need to share. - Hemadri Dasari
@PaoloDell'Aguzzo I haven't used prop types anywhere in my components. - Hemadri Dasari

1 Answers

0
votes

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.