Skip to content

Commit 485c049

Browse files
committed
react router defaults to tree component
1 parent b623c26 commit 485c049

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/app/containers/StateContainer.jsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React, { Component } from 'react';
2-
import { MemoryRouter as Router, Route, NavLink } from 'react-router-dom';
2+
import {
3+
MemoryRouter as Router, Route, NavLink, Switch,
4+
} from 'react-router-dom';
35
import Tree from '../components/Tree';
46
import Chart from '../components/Chart';
57

@@ -14,15 +16,17 @@ class StateContainer extends Component {
1416
<Router>
1517
<div className="state-container">
1618
<div className="navbar">
17-
<NavLink className="router-link" activeClassName="is-active" to="/tree">
19+
<NavLink className="router-link" activeClassName="is-active" exact to="/">
1820
Tree
1921
</NavLink>
20-
<NavLink className="router-link" activeClassName="is-active" to="/chart">
22+
<NavLink className="router-link" activeClassName="is-active" exact to="/chart">
2123
Chart
2224
</NavLink>
2325
</div>
24-
<Route path="/tree" render={() => <Tree snapshot={snapshot} />} />
25-
<Route path="/chart" render={() => <Chart snapshot={snapshot} />} />
26+
<Switch>
27+
<Route path="/chart" render={() => <Chart snapshot={snapshot} />} />
28+
<Route path="/" render={() => <Tree snapshot={snapshot} />} />
29+
</Switch>
2630
</div>
2731
</Router>
2832
);

0 commit comments

Comments
 (0)