2017-05-30 205 views
0

我想在我的反應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即本地主機代碼:3000 /記錄/ 16655,然後我得到這樣的錯誤「http://localhost:3000/record/index.js未找到」。

這可能是什麼解決方案?

這裏是我的參考

"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", 

回答

0

嘗試嵌套這樣

... 

<Route path='/record' ...> 
    <Route path='/:meid' ../> 
</Route> 
基礎上 React-router tutorial#nested-routes

<App>  {/*/  */} 
    <Repos> {/* /repos  */} 
    <Repo/> {/* /repos/123 */} 
    </Repos> 
</App> 

你的路由的package.json