Skip to content

Comments

Ben Tsao#252

Open
cbtsao47 wants to merge 5 commits intobloominstituteoftechnology:masterfrom
cbtsao47:master
Open

Ben Tsao#252
cbtsao47 wants to merge 5 commits intobloominstituteoftechnology:masterfrom
cbtsao47:master

Conversation

@cbtsao47
Copy link

No description provided.

Copy link

@szincone szincone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job using your react-router props (match and location) to make sure the image that is displayed is the correct one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants