Skip to content

Commit

Permalink
update router
Browse files Browse the repository at this point in the history
  • Loading branch information
gandalfTheBlue committed Jan 23, 2019
1 parent 52ac744 commit 92d7c84
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
7 changes: 7 additions & 0 deletions project-react1/src/components/About/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";

const About = () => {
return <div>React project 1 About</div>;
};

export default About;
14 changes: 12 additions & 2 deletions project-react1/src/components/app/index.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import React from "react";
import { Link } from "react-router-dom";
import styles from "./app.module.css";
import { AppRouter } from "../appRouter";

const App = () => {
return (
<div className={styles.container}>
tests
{/* <AppRouter /> */}
<nav>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/about/">About</Link>
</li>
</ul>
</nav>
<AppRouter />
</div>
);
};
Expand Down
3 changes: 2 additions & 1 deletion project-react1/src/components/appRouter/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as React from "react";
import { Route } from "react-router-dom";
import App from "../app";
import About from "../About";

export const AppRouter = () => (
<div>
<Route exact path="/" component={App} />
<Route exact path="/about" component={About} />
</div>
);

0 comments on commit 92d7c84

Please sign in to comment.