我正在嘗試在React中製作一個簡單的嚮導,並嘗試使用Rackt的react-router。React-Router Links組件聲明
我有問題,與進口的外部組件路由確定指標
import React from 'react'
import { render } from 'react-dom'
import { Router, Route, Link } from 'react-router'
import Wizard from './Wizard/Wizard.js'
class Wizard1 extends React.Component {
render() {
return (
<div><Link to="/step2">#2 lol</Link></div>
);
}
}
class Wizard2 extends React.Component {
render() {
return (
<div><Link to="/step3">#3</Link></div>
);
}
}
class Wizard3 extends React.Component {
render() {
return (
<div>Wizard3</div>
);
}
}
render((
<Router>
<Route path="/" component={Wizard}>
<Route path="step1" component={Wizard1}/>
<Route path="step2" component={Wizard2}/>
<Route path="step3" component={Wizard3}/>
</Route>
</Router>
), document.getElementById('root'))
和外部組件Wizard
這樣定義
import React from 'react';
import { Link } from 'react-router'
export class Wizard extends React.Component {
render() {
return (
<Link to="/step1">START</Link>
);
}
}
和啓動鏈接不呈現,手動導航到這些步驟工作正常。指導將非常感謝。在控制檯中沒有錯誤,除了上述問題,應用程序運行良好。
最好的問候。