使用反应路由器

时间:2017-03-28 00:53:05

标签: reactjs hyperlink uinavigationcontroller popup react-router

我试图获取弹出模块的单独网址,我使用按钮重定向:

trigger={ <Link href="/exercisesadd">
          <Button style={style} waves='light' > Add new</Button></Link>
        }>

但我收到404错误,即使我在路由器中有这条路线:

    export default () => {
    return <Route path="/"component={Container} auth={auth}>
        <IndexRoute component={Home}/>
        <Route path="/portfolio"  onEnter={requireAuth} component={Portfolio} />
        <Route path="/Login" component={Home} />
        <Route path="/home" component={Home}  />
        <Route path="/edit" component={Edits}/>
        <Route path="/exercises" component={Exercises}/>
        <Route path="/exercisesadd" component={Exercises}/>
    </Route>
};

1 个答案:

答案 0 :(得分:5)

Link组件采用'to'prop而不是href。所以你想要

<Link to="/exerciseadd">