Conversation
szincone
left a comment
There was a problem hiding this comment.
Great project for Day 2 React-Router. I'm seeing a lot of things in here that I didn't figure out until further along in the course (nested dynamic paths, using the react-router props in javascripty ways to make sure the image is being displayed correctly). You are in a really good spot as far as the rest of react router is concerned.
| return ( | ||
| <nav className="main-nav"> | ||
| {props.data.map((item, i) => ( | ||
| <Link to={`/${item.name}`} key={i}> |
There was a problem hiding this comment.
Great job making your links dynamic. They are all working and take me to the individual image.
| render={props => <SubNav {...props} data={this.state.data} />} | ||
| /> | ||
| <Route | ||
| path="/:itemName/:subItem" |
There was a problem hiding this comment.
This is pretty advanced stuff for day 2 of React Router, being able to make a nested dynamic path.
|
|
||
| const SubItem = props => { | ||
| const subItemName = props.match.params.subItem.split("-").join(" "); | ||
| const currentLocation = props.location.pathname.split("/")[1]; |
There was a problem hiding this comment.
Good job using your react-router props (match and location) to make sure the image that is displayed is the correct one.
No description provided.