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

goeun // edges // litter patrol #42

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

Conversation

goeunpark
Copy link

@goeunpark goeunpark commented Dec 1, 2018

Litter Patrol

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How are events / event handlers and this.state connected? event handlers (such as click) changes the this.state in app.js lines 43 - 46
What are two ways to do "dynamic styling" with React? When should they be used? you can add inline style to html directly or add a class on html to refer to css
Much like Rails works with the HTTP request->response cycle, React works with the browser's input->output cycle. Describe React's cycle from receiving user input to outputting different page content. react responds to click on the individual GameItem level, which triggers onClick={this.spottedItem} which has a callback markClickedCallbackwhich in turn triggers onItemClicked in the App, which updates the value of the spotted prop and sets the state of the array of all GameItems
Compare how React and Rails' views differ. Given different circumstances, these systems have different goals. How does this impact on their design and how we are supposed to use them? Rails respond to clicks to refresh the webpage while React (so far?) is a single-page application that updates without refreshing the page
What was a challenge you were able to overcome on this assignment? Reading starter code, getting a better idea of the difference between state and props (not 100% there yet)

CS Fundamentals Questions

Question Answer
Consider the code on the first few lines of App.render (it starts with this.state.items.map). What is the Big-O time complexity of this code, where n is the number of active game items? O(n)
What part of React might benefit most from the use of specific data structure and algorithms? React updates a lot of data asynchronously and is adding / removing data rapidly. So possibly linked lists over arrays / store information as stored data
Consider what happens when React processes a state change from setState -- it must re-render all of the components that now have different content because of that change.
What kind of data structure are the components in, and what sort of algorithms would be appropriate for React's code to "traverse" those components?
Speculate wildly about what the Big-O time complexity of that code might be.

@dHelmgren
Copy link

Litter Patrol

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Good
Comprehension questions Good
Functionality
Clicking on litter or nature shows a check or X respectively Yes, though see comment for a tip.
Clicking on litter appropriately updates the score Yes
Under the Hood
JavaScript is well-organized and easy to read yes
Functions are named appropriately yes
Callback functions are passed to components appropriately yes
Overall Good work on this assignment! Your use of callback functions tells me that the important learning goals for this assignment were met.

<div className="game-item" style={itemStyle}>
<img src={icon} alt="Item" className="icon-item"></img>
<div className={isSpotted} style={itemStyle} >
<img src={icon} alt="Item" className="icon-item" onClick={this.spottedItem}></img>

Choose a reason for hiding this comment

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

To get a better chance of the click registering, I would put the onClick in the div tag rather than the img tag.

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