当我点击链接时,它会将我带到URL中的正确路由器,但它说它与任何路由都不匹配。我非常困惑。
const rows = surveyList.map((survey) => {
return(<tr key={survey[0].Id}>
<td>{survey[0].Name}</td>
<td>
<Link className="links glyphicon glyphicon-edit" to={`surveydetail/${survey[0].Id}`} onClick={editSurvey}></Link>
</td>
<td>{survey[0].Entity}</td>
<td>{ getSurveyTypeDescription(survey[0].Type)}</td>
</tr>);
});
这是routes.js文件。
import React from 'react';
import {Route, IndexRoute} from 'react-router';
import App from './components/App';
import EditSurveyPage from './components/survey/EditSurveyPage';
import SurveyMaintenancePage from './components/survey/SurveyMaintenancePage';
export default (
<Route path="SurveyMaintenance" component={App}>
<IndexRoute component={SurveyMaintenancePage}/>
<Route path="surveydetail/:id" component={EditSurveyPage} />
</Route>
);
我错过了什么吗?
答案 0 :(得分:0)
className无法正常使用Link.Instead使用NavLink。