Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Building Applications with React and Redux Putting it all Together Updating the Player, Counter and AddPlayerForm Components

Rodrigo Novaes
Rodrigo Novaes
9,629 Points

Uncaught TypeError: _react.default.createContext is not a function

I'm getting this error and the app won't render:

Uncaught TypeError: _react.default.createContext is not a function
    at Object.<anonymous> (bundle.js:31462)
    at __webpack_require__ (bundle.js:556)
    at fn (bundle.js:87)
    at Object.<anonymous> (bundle.js:31248)
    at __webpack_require__ (bundle.js:556)
    at fn (bundle.js:87)
    at Object.<anonymous> (bundle.js:31177)
    at __webpack_require__ (bundle.js:556)
    at fn (bundle.js:87)
    at Object.<anonymous> (bundle.js:8681)

3 Answers

John Nguyen
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
John Nguyen
Full Stack JavaScript Techdegree Graduate 30,501 Points

I had the same issue. Similar to with what David said, it (most likely) has to do with your react-redux and redux versions.

I solved the issue by

1) downloading the project files(for this video) and copying the package.json file from the 'final' version of this video.

Package.json

{
  "name": "react-redux-course",
  "version": "1.0.0",
  "description": "React-Redux course for Treehouse",
  "main": "src/index.js",
  "scripts": {
    "prestart": "npm run lint",
    "start": "webpack-dev-server --progress --inline --hot",
    "lint": "eslint ./src/**/*.{js, jsx} --fix",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "react",
    "redux",
    "treehouse"
  ],
  "author": "Beau Palmquist",
  "license": "MIT",
  "dependencies": {
    "react": "^15.3.2",
    "react-dom": "^15.3.2",
    "react-redux": "^4.4.5",
    "redux": "^3.6.0"
  },
  "devDependencies": {
    "babel-core": "^6.13.2",
    "babel-eslint": "^6.1.2",
    "babel-loader": "^6.2.7",
    "babel-preset-es2015": "^6.13.2",
    "babel-preset-react": "^6.11.1",
    "babel-preset-stage-0": "^6.5.0",
    "eslint": "^3.3.1",
    "eslint-plugin-react": "^6.1.2",
    "react-hot-loader": "^1.3.0",
    "webpack": "^1.13.2",
    "webpack-dev-server": "^1.16.2"
  }
}

2) running npm i

And that should fix the issue.

If you are still running into issues, you'd want to check your code compared to the 'final' version of this video's code. I had to do this and I used diffchecker.com to compare my code to the 'final' version.

I receive the same TypeError, and neither of the proposed solutions by David or John corrected the issue.

David Hamilton
David Hamilton
21,522 Points

The issue is with using a newer version of react-redux with an old version of react.

You can get it to work by going into the package.json and changing the react-redux version to "^5.0.0".