Uncaught TypeError: Cannot read property 'replace' of undefined (react-router)
"react-router": "^2.2.4",
"react": "^0.14.8",
ES6
Uncaught TypeError: Cannot read property 'push' of undefined Uncaught TypeError: Cannot read property 'replace' of undefined Uncaught TypeError: Cannot read property 'transitionTo' of undefined
this.context.router is undefined · Issue #975 · reactjs/react-router · GitHub
同じファイルのクラス定義の後に、
Login.contextTypes = { router: React.PropTypes.func.isRequired };
を足したらエラーにならなくなった。でもwarningになる。
Warning: Failed Context Types: Invalid context `router` of type `object` supplied to `Login`, expected `function`. Check the render method of `RouterContext`.
Login.contextTypes = { router: React.PropTypes.object.isRequired };
に変えたら、Warningもなくなったっぽい。