You can show <Frontpage />
only if the route exactly matches with /
like so:
render() {
return (
<Router>
<div className="App">
<Switch>
<Route path='/' exact >
<Frontpage />
<Link to={'/Question'} className="nav-link"> Los geht's </Link>
</Route>
<Route path='/Question' component={Question} />
</Switch>
</div>
</Router>
);
You can achieve it like this:
render() {
const SelectedComponent = someCondition ? Question : OtherComponent;
return (
<Router>
<div className="App">
<Frontpage />
<Link to={'/Question'} className="nav-link"> Los geht's </Link>
<Switch>
<Route path='/Question' component={SelectedComponent} />
</Switch>
</div>
</Router>
);
}
[ { "id":100, "account_id":8, "name":"Out of Service", "default":false, "created_at":"2012-02-06T08:51:29.720-06:00", "updated_at":"2012-02-06T08:51:29.720-06:00" },...
[ { "id":100, "account_id":8, "name":"Out of Service", "default":false, "created_at":"2012-02-06T08:51:29.720-06:00", "updated_at":"2012-02-06T08:51:29.720-06:00" },...
I'm building a new website with a navbar with a dropdown menu and want to have the dropdown disappear when I click on another button or other part of the site. How do I code that? The code below is ...
I'm building a new website with a navbar with a dropdown menu and want to have the dropdown disappear when I click on another button or other part of the site. How do I code that? The code below is ...
I've made a modal with the help of javascript. How come the modal doesn't come out? These are my codes: <button class="jobview-control btn-primary jobview-btn" id="btn-show-modal">Recommend&...
I've made a modal with the help of javascript. How come the modal doesn't come out? These are my codes: <button class="jobview-control btn-primary jobview-btn" id="btn-show-modal">Recommend&...
arr = Array(10).fill(false) arr[-2] = true console.log(arr) [false, false, false, false, false, false, false, false, false, false, -2: true] console.log(arr.length) // 10 I'm so surprised that ...
arr = Array(10).fill(false) arr[-2] = true console.log(arr) [false, false, false, false, false, false, false, false, false, false, -2: true] console.log(arr.length) // 10 I'm so surprised that ...