【发布时间】:2017-05-30 14:03:38
【问题描述】:
我正在尝试在我的 react redux 应用程序中使用参数,但不幸的是它不起作用。我得到一个空白屏幕。这是我正在关注的代码
import React from 'react';
import ReactDOM from 'react-dom';
import {Router, Route, browserHistory} from 'react-router';
import thunk from 'redux-thunk';
import rootReducer from './rootReducer';
import { createStore, applyMiddleware, compose } from 'redux';
const store = createStore(
rootReducer,
compose(
applyMiddleware(thunk),
window.devToolsExtension ? window.devToolsExtension() : f => f
)
);
ReactDOM.render(
<Provider store={store}>
<Router history={browserHistory}>
<Route path="/" component={Login}/>
<Route path="/lists" component={requireAuth(Dashboard)}/>
{/* Parameter route*/}
<Route path="/record/:mEID" component={requireAuth(Record)}/>
</Router>
</Provider>,
document.getElementById('root')
);
当我转到我的本地主机 URL 时,即 localhost:3000/record/16655 然后我收到类似“http://localhost:3000/record/index.js 未找到”的错误。
有什么办法可以解决这个问题???
这是我的 package.json 供参考
"lodash": "^4.17.4",
"prop-types": "^15.5.10",
"react": "^15.1.0",
"react-bootstrap": "^0.31.0",
"react-bootstrap-table": "^3.3.7",
"react-dom": "^15.1.0",
"react-fontawesome": "^1.6.1",
"react-redux": "^4.4.5",
"react-router": "^3.0.2",
"redux": "^3.5.2",
"redux-thunk": "^2.1.0",
【问题讨论】:
-
你最终解决了这个问题吗?
标签: reactjs react-router react-redux