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:
William Chargin 2018-06-29 13:55:45 -07:00 committed by GitHub
parent 1d49ec87dc
commit d74d760f43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View File

@ -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

30
src/v3/app/App.js Normal file
View File

@ -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>
);