react-modal
react-modal copied to clipboard
Uncaught TypeError: Cannot read property 'Component' of undefined
When trying to build an app with this dependency, react logs the following error to the console. I've set the appElement
to '#root'
in my index.js
file and tried using ariaHideApp={false}
, but neither have solved the error.
Uncaught TypeError: Cannot read property 'Component' of undefined
at Object.<anonymous> (react-modal.min.js:34)
at n (react-modal.min.js:1)
at Object.<anonymous> (react-modal.min.js:13)
at n (react-modal.min.js:1)
at Object.<anonymous> (react-modal.min.js:13)
at n (react-modal.min.js:1)
at react-modal.min.js:1
@finleyowen Which version are you using?
Same issue i am using version 3.14.3
If you are using <Modal appElement={node} />
, node
needs to be a dom node...not a string. Can you check if this is the issue?
I'm facing a similar issue. Here are the attributes I'm passing on to ReactModal.
<ReactModal
ariaHideApp={false}
isOpen={showLoginModal}
onRequestClose={closeModal}
className="bg-whitish w-[80%] h-[70%] md:w-[50%] md:h-[30%] rounded-md absolute top-[50%] left-[50%] transform -translate-x-1/2 -translate-y-1/2 border border-blackish flex flex-col justify-center items-center"
>
Here is the error I'm getting.
Uncaught TypeError: Cannot read properties of undefined (reading 'Component')
at Object.<anonymous> (react-modal.min.js:34:9446)
at n (react-modal.min.js:1:450)
at Object.<anonymous> (react-modal.min.js:13:4246)
at n (react-modal.min.js:1:450)
at Object.<anonymous> (react-modal.min.js:13:3589)
at n (react-modal.min.js:1:450)
at react-modal.min.js:1:1250
at react-modal.min.js:1:1259
at react-modal.min.js:1:290
at react-modal.min.js:1:312
Can someone help me out with this?
@MadhavKauntia which version are you using?
@diasbruno 3.15.1
Please, check if this is an incompatibility with newer version of react like 17+.
Uncaught TypeError: Cannot read properties of undefined (reading 'Component')
at Object.
version is: "react-modal": "^3.16.1",
If you want to make a reproducible example for this...one can create a new react project and add react
and react-modal
(with some combination of versions).
This should trigger the issue, and, we can finally address it.
As people have found out, if you delete node_modules
and reinstall everything, it works. It seems a cache issues.
Please, feel free to reopen if that's not your case.
As people have found out, if you delete
node_modules
and reinstall everything, it works. It seems a cache issues. Please, feel free to reopen if that's not your case.
It still don't work having same issue my react-modal version "react-modal": "^3.16.1" and react version "react": "^18.2.0",
error. "react-modal.min.js:34 Uncaught TypeError: Cannot read properties of undefined (reading 'Component')
at Object.
react-modal.min.js:34 Uncaught TypeError: Cannot read properties of undefined (reading 'Component')
at Object.
same issue I am getting. react-modal version "react-modal": "^3.16.1" and react version "react": "^18.2.0",