Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set property 'parentContext' of undefined #110

Open
Dante-101 opened this issue May 14, 2017 · 9 comments
Open

Cannot set property 'parentContext' of undefined #110

Dante-101 opened this issue May 14, 2017 · 9 comments

Comments

@Dante-101
Copy link

I am getting this error with react-lite. The app works fine with react and react-dom. Any suggestions what could be wrong?

Uncaught (in promise) TypeError: Cannot set property 'parentContext' of undefined
    at initVcomponent (react-lite.common.js:433)
    at initVnode (react-lite.common.js:52)
    at initVcomponent (react-lite.common.js:442)
    at initVnode (react-lite.common.js:52)
    at initVchildren (react-lite.common.js:190)
    at initVelem (react-lite.common.js:173)
    at initVnode (react-lite.common.js:49)
    at initVchildren (react-lite.common.js:190)
    at initVelem (react-lite.common.js:173)
    at initVnode (react-lite.common.js:49)
@Lucifier129
Copy link
Owner

Lucifier129 commented May 14, 2017

Try adding breakpoint at this line, and check whether vcomponent.type is valid or not.

@Dante-101
Copy link
Author

vcomponent.type is valid. It is set to a component of this external package - https://github.com/Pomax/react-onclickoutside

Here is the debug session screenshot

@Lucifier129
Copy link
Owner

OK. Can you add a simple code example to reproduce this problem?

@ChieveiT
Copy link

ChieveiT commented May 15, 2017

I got the same exception a few days ago and I fixed it after adding "key" prop for and of antd. Maybe you can check whether there are some elements created by the same component and having the same parent but do not have "key" prop. "react-lite just follow the best practice of React."XD


I'm wrong, just forget the above comment...The exception still exists...I tried to traceback with chrome dev tools tonight, it shows that the code using createReactClass will trigger this exception, "$cache" prop in ReactComponent is initialized in constructor...However, ReactClassComponent.prototype used by createReactClass only mixin ReactComponent.prototype and never call the constructor of ReactComponent...I'm working on it, maybe I can give you a PR tomorrow. @Lucifier129

@Lucifier129
Copy link
Owner

@ChieveiT Great!

@drcmda
Copy link

drcmda commented Jun 7, 2017

@Lucifier129
I have the same problem, it persisted for months, checked back today and still the same. Is there anything we can do to help it or at least is there an explanation of what's wrong?

@Lucifier129
Copy link
Owner

Lucifier129 commented Jun 8, 2017

@drcmda It seems like the constructor of super class was not invoked, so this.$cache is undefined, read parentContext property from undefined would throw error.

@hskww
Copy link

hskww commented Jun 27, 2017

i has the same error:
Uncaught TypeError: Cannot set property 'parentContext' of undefined
at initVcomponent (react-lite.common.js:433)

beside,this page use react-router,and other pages(no router) work sucessfully

@Bbooth4
Copy link

Bbooth4 commented Sep 7, 2017

I have gotten the same error verbatim. The likely difference in my setup from others is that I am using electron. I am uncertain if this would impact react-lite in anyway?

Has a solution been reached for this issue or simply an explanation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants