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

Pushpa_Agr_Edges #38

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

Pushpa_Agr_Edges #38

wants to merge 2 commits into from

Conversation

pushpaagr
Copy link

Litter Patrol

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How are events / event handlers and this.state connected? The event handlers and this.state are connected when the call back function is called it allows us to use this.state to manipulate the data.
What are two ways to do "dynamic styling" with React? When should they be used? The two ways to use dynamic styling with react are state and props, if you need to change the data then should think about use state, however if you are only using it without making any changes to it can use props.
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. When a user does something on the page (clicks) and you have an event listener on that it can then call a function which can change it's state, you can also have a callbackfunction which can change the state of the object too. And then the page will rerender since the state got changed.
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 provides a simple way to create a webpage, React allows for a better way for a user to interact with the webpage, and allows the page to re-render only the changed parts.
What was a challenge you were able to overcome on this assignment? Working with nested components was challenging.

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? The Time complexity of this would be O(n) liner since it is iterating through all the items in the array.
What part of React might benefit most from the use of specific data structure and algorithms? I think using hashes would get the most benefit since their lookup time is O(1), and you can quickly check to if the value matches what your data says and then respond accordingly.
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.
In the setState, the components are in a hash like structure. I think the structure might be an array of hashes, and the Big-O would be O(n)????

…rease points, also added logic if item was clicked and it was litter to display green arrow else onclick it will display red x
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