0
내가 가진 몇 가지 문제를 사용하지 않고 오류 라우터 반응하고 : 그에서 오는 될 수있다특별히에도 반응 라우터-DOM과 그것을
warning.js?8a56:36 Warning: Failed prop type: The prop `history` is marked as required in `Router`, but its value is `undefined`.
in Router
printWarning @ warning.js?8a56:36
warning @ warning.js?8a56:60
checkReactTypeSpec @ checkReactTypeSpec.js?d08c:80
validatePropTypes @ ReactElementValidator.js?a599:161
createElement @ ReactElementValidator.js?a599:213
(anonymous) @ app.jsx?0ec4:14
(anonymous) @ bundle.js:1289
__webpack_require__ @ bundle.js:20
(anonymous) @ bundle.js:66
(anonymous) @ bundle.js:69
Router.js?a4aa:31 Uncaught TypeError: Cannot read property 'location' of undefined
at new Router (eval at <anonymous> (bundle.js:794), <anonymous>:39:52)
at eval (eval at <anonymous> (bundle.js:2335), <anonymous>:295:18)
at measureLifeCyclePerf (eval at <anonymous> (bundle.js:2335), <anonymous>:75:12)
at ReactCompositeComponentWrapper._constructComponentWithoutOwner (eval at <anonymous> (bundle.js:2335), <anonymous>:294:16)
at ReactCompositeComponentWrapper._constructComponent (eval at <anonymous> (bundle.js:2335), <anonymous>:280:21)
at ReactCompositeComponentWrapper.mountComponent (eval at <anonymous> (bundle.js:2335), <anonymous>:188:21)
at Object.mountComponent (eval at <anonymous> (bundle.js:387), <anonymous>:46:35)
at ReactCompositeComponentWrapper.performInitialMount (eval at <anonymous> (bundle.js:2335), <anonymous>:371:34)
at ReactCompositeComponentWrapper.mountComponent (eval at <anonymous> (bundle.js:2335), <anonymous>:258:21)
at Object.mountComponent (eval at <anonymous> (bundle.js:387), <anonymous>:46:35)
궁금했다. 컴파일 된 파일에서 완전히 제거했습니다.
그래서
import ReactDom from 'react-dom';
const Error =() => <h1>Error</h1>;
ReactDom.render(
<Error/>
,
document.getElementById('react-app'));
을 app.js : 그 성가신 오류가 오는 곳에서
난 그냥 알아 내가 가능한 한 단순하게 수정 된 주요 반응 파일을 컴파일 웹팩을 사용하여 나는 기본적으로react-router-dom
을 더 이상 사용하지 않지만 어떤 이유로 든 오류가 거기에 머물러 있습니다.
웹팩 coniguration :
module.exports = {
entry: './client/src/app.js',
devtool: '#eval-source-map',
output: {
path: __dirname + '/client/dist/',
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|app-server.js)/,
loader: 'babel-loader'
}
]
}
};
은 이미 당신의 제안을 모두 노력했다. 나는 지금 바꿀 것인가를 확인하기 위해 browserify를 할 것이지만 분명히 나는 babelify 모듈을 필요로한다. –
이 경우에는'babel-preset-es2015','babel-preset-react' 및'babelify'를 당신의 dev 의존성에 설치해야합니다. –
완료. 나는 당신의 접근 방법도 시도했다. 나는 같은 오류가있다. –