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 #75

Closed
feross opened this issue Oct 1, 2016 · 6 comments
Closed

Cannot set property 'parentContext' of undefined #75

feross opened this issue Oct 1, 2016 · 6 comments

Comments

@feross
Copy link

feross commented Oct 1, 2016

According to #70, this error is caused by react-lite lacking support for ES6 class syntax.

Can you please add support for that? Without it, it's impossible for most modern React codebases to take advantage of react-lite.

@Lucifier129
Copy link
Owner

Got it, I will try to fixed this problem as soon.

@Lucifier129
Copy link
Owner

Lucifier129 commented Oct 8, 2016

When I tryed to reproduce this problem, I found that babel has been resolved it.

before

function App(props, context) {
        _classCallCheck(this, App);

        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(App).call(this, props, context));

        _this.state = {
            count: 0
        };
        return _this;
    }

after

    function App(props, context) {
        _classCallCheck(this, App);

        var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, props, context));

        _this.state = {
            count: 0
        };
        return _this;
    }

Upgrade babel to lastest version.

@feross
Copy link
Author

feross commented Oct 13, 2016

I am using buble, so that might explain the issue. Sorry for the trouble.

@feross feross closed this as completed Oct 13, 2016
@wumingli
Copy link

how to config .babelrc?

my config below:
{ "presets": ["react", "es2015"], "plugins": ["transform-es2015-classes"] }
still show "Cannot set property 'parentContext' of undefined".
thanks

@Dante-101
Copy link

Dante-101 commented Apr 19, 2017

I am getting this error with the following packages. When I use react instead of react-lite, everything works. What can I change for now to make it work?

"devDependencies": {
    "@types/chai": "3.5.1",
    "@types/d3": "4.7.0",
    "@types/enzyme": "2.7.9",
    "@types/express": "4.0.35",
    "@types/jsdom": "2.0.30",
    "@types/lodash": "4.14.62",
    "@types/mocha": "2.2.41",
    "@types/react": "15.0.22",
    "@types/react-addons-css-transition-group": "15.0.1",
    "@types/react-addons-transition-group": "0.14.19",
    "@types/react-dom": "15.5.0",
    "@types/react-redux": "4.4.38",
    "@types/react-router": "3.0.11",
    "@types/react-router-redux": "4.0.46",
    "@types/redux-logger": "3.0.0",
    "@types/sinon": "2.1.2",
    "awesome-typescript-loader": "3.1.2",
    "babel-cli": "6.24.1",
    "babel-core": "6.24.1",
    "babel-loader": "6.4.1",
    "babel-plugin-lodash": "3.2.11",
    "babel-polyfill": "6.23.0",
    "babel-preset-es2015": "6.24.1",
    "babel-preset-react": "6.24.1",
    "babel-preset-react-optimize": "1.0.1",
    "babel-preset-stage-2": "6.24.1",
    "chai": "3.5.0",
    "chunk-manifest-webpack-plugin": "1.0.0",
    "clean-webpack-plugin": "0.1.16",
    "enzyme": "2.8.2",
    "express": "4.15.2",
    "html-webpack-inline-chunk-plugin": "^1.0.0",
    "html-webpack-plugin": "2.28.0",
    "jest": "19.0.2",
    "jsdom": "9.12.0",
    "lodash": "4.17.4",
    "lodash-webpack-plugin": "0.11.2",
    "mocha": "3.2.0",
    "react-addons-test-utils": "15.5.1",
    "redux": "3.6.0",
    "sinon": "2.1.0",
    "source-map-loader": "0.2.1",
    "webpack": "2.4.1",
    "webpack-manifest-plugin": "1.1.0"
  },
  "dependencies": {
    "d3": "4.8.0",
    "react": "15.5.4",
    "react-addons-css-transition-group": "15.5.2",
    "react-addons-transition-group": "15.5.2",
    "react-dom": "15.5.4",
    "react-lite": "0.15.34",
    "react-redux": "5.0.4",
    "react-router": "3.0.5",
    "react-router-redux": "4.0.8",
    "redux": "3.6.0",
    "redux-logger": "3.0.1",
    "redux-thunk": "2.2.0"
  }

The error I get is

react-lite.common.js:433 Uncaught 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 renderTreeIntoContainer (react-lite.common.js:1931)
    at render (react-lite.common.js:1967)

@blackswanny
Copy link

i am getting this error too with latest 6.24.1 babel and it's dependencies such as @Dante-101 has

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

5 participants