請你告訴我,爲什麼路由器是不確定的反應。我的js已經導入反應-router.js文件在我codepen爲什麼路由器在反應js中未定義?
這裏是我的代碼 http://codepen.io/naveennsit/pen/pymqPa?editors=1010
class App extends React.Component {
render() {
return <Router>
<Route path='/' component={first}></Route>
<Route path='/about' component={second}></Route>
</Router>
}
}
class second extends React.Component {
render() {
return <label>second component</label>
}
}
class first extends React.Component {
render() {
return <label>first component</label>
}
}
React.render(< App/> , document.getElementById('app'))
請參閱我的設置文件。我導入的,, – user944513
請刪除您的錯誤\ – user944513
但仍不會顯示第一個組件HTTP ://codepen.io/naveennsit/pen/KzLJqE?editors = 1010 – user944513