Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ports - Kasey #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Ports - Kasey #21

wants to merge 3 commits into from

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
@@ -15,6 +15,7 @@ class App extends Component {
<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