Skip to content
Permalink
Browse files

feat: props in react router

  • Loading branch information...
Param-Harrison committed Jun 18, 2019
1 parent a1f663b commit 45efaedd0f0b2e74f231fe131f1bea327a0a96ac
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/App.js
@@ -74,6 +74,12 @@ const NoMatchPage = () => {
);
};
const PropsPage = ({title}) => {
return (
<h3>{title}</h3>
);
};
const App = () => {
return (
<section className="App">
@@ -83,12 +89,16 @@ const App = () => {
<Link to="/users">Users</Link>
<Link to="/search?q=react">Search</Link>
<Link to="/404-not-found">404</Link>
<Link to="/props-through-component">Props through component</Link>
<Link to="/props-through-render">Props through render</Link>
<Switch>
<Route exact path="/" component={IndexPage} />
<Route exact path="/users" component={UsersPage} />
<Route exact path="/user/:userId" component={UserPage} />
<Route exact path="/about" component={AboutPage} />
<Route exact path="/search" component={SearchPage} />
<Route exact path="/props-through-component" component={() => <PropsPage title={`Props through component`} />} />
<Route exact path="/props-through-render" render={(props) => <PropsPage {...props} title={`Props through render`} />} />
<Route component={NoMatchPage} />
</Switch>
</Router>

0 comments on commit 45efaed

Please sign in to comment.
You can’t perform that action at this time.