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

lindsay - edges - litter-patrol #48

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

Conversation

elle-terch
Copy link

Litter Patrol

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How are events / event handlers and this.state connected? In my implementation, when a user clicks on something, this.state gets updated to reflect that it has been clicked.
What are two ways to do "dynamic styling" with React? When should they be used? 1) You can create a single style object that gets updated before the return (and called within the return). This worked well for me when I had to include multiple styles. 2) I'm guessing you can do inline styling when you are only working with a single style.
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 sends information between components using props and stores data using state. Unlike Rails, where data can be modified all over the place, props cannot be modified within a component. This helps make clear distinctions between what each component is supposed to do.
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? In React, views can be changed a lot more dynamically. Views and logic seem to be a bit more separated in Rails.
What was a challenge you were able to overcome on this assignment? A few: figuring out how to work with multiple classes in JS, figuring out how to pass a parent's function to a component, and understanding the difference between dot and bracket notation (this last one was a huge hurdle in Wave 1).

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 each item had to be iterated over to be added to the new array.
What part of React might benefit most from the use of specific data structure and algorithms? Probably the initial App because it would likely interact with some sort of API or data file.
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.
State is an object (which closely resembles a hash). I'm not totally sure how to answer the algorithm question, tbh. I'm guessing that time complexity would be O(n) where n represents the number of properties within state.

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