react-router: Warning: Failed Context Types: Required context `router` was not specified

- 1 answer

Ad

I clone the latest react-router repo:

everything works fine,

and I copy the auth-flow example into my own folder to run a test demo

but it get this error:

enter image description here

webpack.config.js

module.exports = {
entry: './app.js',
output: {
    path: __dirname + '/build/',
    filename: 'bundle.js'
},
module: {
    loaders: [
        {
            test: /\.jsx?$/,
            exclude: /(node_modules|bower_components)/,
            loader: 'babel',
            query: {
                presets: ['react', 'es2015']
            }
        }
    ]
}
};

package.json

{
    "name": "reacttest",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
        "babel-core": "^6.3.26",
        "babel-loader": "^6.2.0",
        "babel-preset-es2015": "^6.3.13",
        "babel-preset-react": "^6.3.13",
        "history": "^1.17.0",
        "react": "^0.14.3",
        "react-dom": "^0.14.3",
        "react-router": "^1.0.3",
        "webpack": "^1.12.9"
    }
}

what did I miss, how to fix this error?

Ad

Answer

Ad

should use History mixin instead.

checkout to latest branch to see the right example code

Ad
source: stackoverflow.com
Ad