我想重定向页面到不同的组件,我得到did not match any route
错误。反应路由器不匹配任何路由
阵营路由器版本:
"react-router": "2.4.0",
"react-router-redux": "4.0.4",
Webpack.config文件:输出:
output: {
path: __dirname + '/dist',
publicPath: '/SurveyMaintenance/',
filename: 'bundle.js'
}
应用程序启动:
import {Router, browserHistory} from 'react-router';
import routes from './routes';
<Provider store={store}>
<Router history={browserHistory} routes={routes} />
</Provider>,
document.getElementById('app')
);
我Route.js文件:
<Route path="SurveyMaintenance/" component={App}>
<IndexRoute component={SurveyMaintenancePage}/>
<Route path="surveydetail/:id" component={EditSurveyPage} />
</Route>
链接元素:
<Link to={`surveydetail/${survey.Id}`} onClick={editSurvey}></Link>
地址看起来是正确的,但它仍然清楚地时没有分配给该地址的组件引发此错误。 我一定在做错事。
我只是想你什么建议和地址时: 的http://本地主机:3000/SurveyMaintenance/SurveyMaintenance/surveydetail/449 – vineeth
请参阅更新的答案,你需要设置基本路径: '/' 或添加基名到反应路由器 – Kossel
等待它的工作,但网址是错误的 – vineeth