Add an entry point for the V3 app (#450)
Summary: This implements Step 3 of the plan described in #448. Test Plan: Run `yarn start` and navigate to `/v3` (by clicking the nav link). wchargin-branch: branch-v3
This commit is contained in:
parent
1d49ec87dc
commit
d74d760f43
|
@ -9,6 +9,7 @@ import {
|
|||
} from "react-router-dom";
|
||||
import "./index.css";
|
||||
import V1App from "../../v1/app/App";
|
||||
import V3App from "../../v3/app/App";
|
||||
import registerServiceWorker from "./registerServiceWorker";
|
||||
|
||||
const root = document.getElementById("root");
|
||||
|
@ -23,10 +24,14 @@ ReactDOM.render(
|
|||
<li>
|
||||
<NavLink to="/v1">V1</NavLink>
|
||||
</li>
|
||||
<li>
|
||||
<NavLink to="/v3">V3</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
<Route exact path="/" render={() => <Redirect to="/v1" />} />
|
||||
<hr />
|
||||
<Route path="/v1" component={V1App} />
|
||||
<Route path="/v3" component={V3App} />
|
||||
</React.Fragment>
|
||||
</Router>,
|
||||
root
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
// @flow
|
||||
|
||||
import React from "react";
|
||||
import {Route, NavLink, type Match} from "react-router-dom";
|
||||
|
||||
export default class App extends React.Component<{match: Match}> {
|
||||
render() {
|
||||
const {match} = this.props;
|
||||
return (
|
||||
<div>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<NavLink to={match.url}>Home</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<hr />
|
||||
<Route exact path={match.url} component={Home} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const Home = () => (
|
||||
<div>
|
||||
<h1>Welcome to SourceCred! Please make yourself at home.</h1>
|
||||
</div>
|
||||
);
|
Loading…
Reference in New Issue