React路由和react-router-dom中的问题

时间:2019-07-18 17:12:57

标签: reactjs react-router-dom

我的应用和路由如下:

render() {
    return (
      <Router>
        <UserContext.Provider value={this.state}>

          <div className="container">
            <MyHeader showMenu={this.state.showHeaderMenu} />

            <div className="row">
              <div className='col-lg-3'>
                <MyMenu></MyMenu>
              </div>
              <div className='col-lg-9 page-padder'>

                <Route  path="/" component={SignUp}  exact={true} />
                <Route exact path="/coverletter" component={CoverLetter} />
                <Route exact path="/attachfile" component={AttachFile} />
                <Route exact path="/choosenumber" component={ChooseNumber} />
                <Route exact path="/chooseplan" component={ChoosePlan} />
                <Route exact path="/sendfax" component={SendFax} />
                <Route exact path="/inbox" component={Inbox} />
                <Route exact path="/outbox" component={Outbox} />
                <Route exact path="/account" component={Account} />

                <Route exact path="/freefaxsent" component={FreeFaxSent} />

                <Route exact path="/userprofile" component={UserProfile} />
                <Route exact path="/userprofile/updatedetails" component={UpdateDetails} />

              </div>
            </div>
          </div>
        </UserContext.Provider>
      </Router>
    )
  }

最后一条路由为“ / userprofile / updatedetails”不起作用。我在UserProfile组件中有LINK,单击它时,什么也没发生,也没有错误。我检查了互联网上的各种文档,但其中大多数已过时。

<Link className="ProfileButtons" to="/userprofile/updatedetails">Update Details</Link>

0 个答案:

没有答案