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

Naheed Edges Litter Patrol #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Naheed Edges Litter Patrol #40

wants to merge 1 commit into from

Conversation

arangn
Copy link

@arangn arangn 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 allow you to update state continuously
What are two ways to do "dynamic styling" with React? When should they be used? You can apply class names so that the item type has the correct style, or use inline style which is not best practice.
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. The user clicks, the event listener see's that the item was litter, so it changes the state (points) and rerenders the view.
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? React does not need to refresh to renew, so it allows for more dynamic webpages and asynchronous code.
What was a challenge you were able to overcome on this assignment? It was hard knowing where to start on wave 1, but it seems as though there are a lot less moving parts than rails, which makes it a bit easier to figure out.

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) because it iterates over all items once.
What part of React might benefit most from the use of specific data structure and algorithms? State being an object makes it easy to access and change the value.
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.
Since components have top level and nested components, they are in a tree structure. Traversing a tree follows the steps of visiting the current node, the left child node, then the right child node. I think this would be O(n^2) time complexity because for every node, you have to visit all of its child nodes.

@arangn arangn changed the title implement increase score and item type Naheed Edges Litter Patrol Dec 1, 2018
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.

1 participant