I am new to the react router. what I have is ,
Main.js
render() {
return (
<Router history={history}>
<div>
{this.props.isFetching && <Loading />}
<Switch>
<PrivateRoute exact path="/" component={LandingPage} />
<PrivateRoute exact path="/create-job" component={NewJob} />
<Route exact path="/login" component={Login} />
</Switch>
</div>
</Router>
)
}
}
Now, In this, I have the route which is create-job
. Now, In this there is one container NewJob.js
render() {
return (
<Fragment>
<SubHeader isAuthenticated={localStorage.getItem("access_token") ? true : false} />
<JobNotFound />
</Fragment>
)
}
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>
</div>
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 .