Linked Questions

Popular Questions

Adding the sub Route in the react js React router v4

Asked by At

I am new to the react router. what I have is ,


render() {
    return (
      <Router history={history}>
          {this.props.isFetching && <Loading />}
            <PrivateRoute exact path="/" component={LandingPage} />
            <PrivateRoute exact path="/create-job" component={NewJob} />
            <Route exact path="/login" component={Login} />

Now, In this, I have the route which is create-job . Now, In this there is one container NewJob.js

 render() {
    return (
        <SubHeader isAuthenticated={localStorage.getItem("access_token") ? true : false} />
        <JobNotFound />

Now, In the JObNotFound.js there is a button which is like ,

<div className="col-sm-4">
                <button className="btn btn-lg btn-primary btn-block button-container">Create New Job</button>

Now, Here what I want to do is , onclick of this button, I want to change route to the create-job/New and want to render a new component over there.

So,I am totally confused in this place. Can any one help me with this ?

Thanks .

Related Questions