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

Leanne- NODES #22

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

Leanne- NODES #22

wants to merge 2 commits into from

Conversation

leannerivera
Copy link

@leannerivera leannerivera commented Nov 30, 2018

Litter Patrol

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How are events / event handlers and this.state connected? event handlers can change state
What are two ways to do "dynamic styling" with React? When should they be used? inline styles, and using render
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.
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? i feel like Rails is more useful when saving information, like databases, etc. For dynamic 'one-page' designs React is better.
What was a challenge you were able to overcome on this assignment? getting correct class on click. Also I am not understanding React, I feel like we had more in-depth practice with rails and I am kind of on a standstill on understanding it better....

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? it is linear o(n) since it relies on the length of an array
What part of React might benefit most from the use of specific data structure and algorithms?
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.

@CheezItMan
Copy link

Litter Patrol

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Decent commit messages and a couple of commits, but you're not finished.
Comprehension questions Check
Functionality
Clicking on litter or nature shows a check or X respectively Check
Clicking on litter appropriately updates the score No, but see my inline notes.
Under the Hood
JavaScript is well-organized and easy to read You've got some extraneous code, and you are doing things like directly assigning state outside a constructor.
Functions are named appropriately Check
Callback functions are passed to components appropriately Check
Overall You've got some bugs and see my inline notes. You also need to update your GameItem class' propTypes. See me if you want some support in getting things fixed up.


constructor(props) {
super(props);
this.state = props.state; //change prop state

Choose a reason for hiding this comment

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

I would very much never call a prop state, because it could be confusing. Also you never passed a prop into GameItem from App, so props.state is undefined.

this.clicked = false;
}

static propTypes = {

Choose a reason for hiding this comment

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

Nice that you made this static, but you should also include type and your callback in the list of props.

onMarkLitterClick = () => {
console.log(this);
//change state here
this.clicked = true;

Choose a reason for hiding this comment

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

You should instead do: this.setState( { clicked: true });

console.log(itemType)
if (itemType === "litter") {
this.setState({
point: this.state.points += 1

Choose a reason for hiding this comment

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

This should be points: this.state.points + 1, plural, not singular, and no assignment.

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