File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,4 +196,4 @@ const {id} = props.match.params;
196196
197197or if we console logged ` props ` , the object would look like the following
198198
199- ![ props object] ( images/props )
199+ ![ props object] ( images/props.png )
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import Home from './components/Home';
88import About from './components/About' ;
99import Contact from './components/Contact' ;
1010import Navbar from './components/Navbar' ;
11+ import Profile from './components/Profile' ;
1112
1213class App extends Component {
1314 render ( ) {
@@ -18,6 +19,7 @@ class App extends Component {
1819 < Route exact path = '/' component = { Home } />
1920 < Route path = '/about' component = { About } />
2021 < Route path = '/contact' component = { Contact } />
22+ < Route path = '/profile/:user_id' component = { Profile } />
2123 </ Switch >
2224 </ div >
2325 )
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ const Navbar = () => (
3131 < Link to = "/contact" style = { linkStyle } >
3232 < span > Contact</ span >
3333 </ Link >
34+ { /* this will link to the profile for user with id of 1 */ }
35+ < Link to = "/profile/1" style = { linkStyle } >
36+ < span > Profile</ span >
37+ </ Link >
3438 </ nav >
3539)
3640
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+
3+ const Profile = ( props ) => {
4+ // take the id from props
5+ const { user_id} = props . match . params ;
6+ return < h1 > This is the user profile for the user with the id of { user_id } </ h1 >
7+ } ;
8+
9+ export default Profile ;
You can’t perform that action at this time.
0 commit comments