Skip to content

Conversation

@kaseea
Copy link

@kaseea kaseea commented Jun 11, 2019

React Timeline

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Explain what purpose a component serves in React?
How does adding dynamic content to a web page in React compare to jQuery?
How did you use props in this project?
Do you have any recommendations on how we could improve this project for the next cohort?

@kaseea kaseea changed the title Kasey Ports - Kasey Jun 11, 2019
Copy link

@goblineer goblineer left a comment

Choose a reason for hiding this comment

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

So since we talked about how props work, I wanted to make sure that I pointed to how they're working in the code, since your code is, in fact, working and looks great. But the props are confusing, even after they work.

I left comments throughout that show where tab A fits into slot a, so to speak. I hope it makes sense.

Only other thing is: The className= stuff that you'll be doing to put on CSS styles if you want 'em are stylesheets that already exist, so don't make the mistake I did and waste time trying to write them. There's a Timeline.css and a TimelineEvents.css and they've got all the stuff.

const timelineComponents = props.events.map( (timeline, i) => {
return (
<li key={i}>
<TimelineEvent

Choose a reason for hiding this comment

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

This is where you're passing the props to TimelineEvent.


{/* <h3>{ props.timestamp } </h3> */}
<h3> <Timestamp time= { props.time }/></h3>
{/* so, note to self, it has to match the name time on Timestamp */}

Choose a reason for hiding this comment

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

This is the part where TimelineEvent is catching the props that Timeline passed in.

src/App.js Outdated
<h1 className="App-title">Application title</h1>
</header>
<main className="App-main">
<Timeline events={timelineData.events} />
Copy link

@goblineer goblineer Jun 11, 2019

Choose a reason for hiding this comment

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

This line passes the JSON as a prop into Timeline.

// <Timeline events={timelineData.events} /> already sending it events?
// side question, how would you debug that?

const timelineComponents = props.events.map( (timeline, i) => {

Choose a reason for hiding this comment

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

This .map is running over the events prop that it got from App.js

<section>

{/* <h3>{ props.timestamp } </h3> */}
<h3> <Timestamp time= { props.time }/></h3>

Choose a reason for hiding this comment

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

This part is a little nuts, so bear with it ... Timestamp knows how to make the Very-Robotic-Official-Computer-Science time element from that the JSON has in it into a sentence like "a week ago" or whatever. App.js gave us this stupid time format that's ugly and doesn't fit, but if we REGIFT it to Timestamp, it can use it. Coooool. So the part where it's saying Timestamp time= { props.time } is where TimelineEvents hands the props.time it JUST GOT from App over to Timestamp.

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