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

Edges Chantelle Litter Patrol #20

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

Conversation

BASIC-Belic
Copy link

Litter Patrol

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How are events / event handlers and this.state connected? Event handlers can be called to change states after listening to an event on the component.
What are two ways to do "dynamic styling" with React? When should they be used? One way is to change is to the class of a component / div to match css. The other to do it inline. Inline can be used if there's a var in the component that will determine styling; otherwise use css classes.
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 updates input automatically bc it compares the changes in state against the virtual DOM where as Rails would need to perform a whole new request cycle or re-render the entire page.
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 views gets its data from a DB/model which is connected to the view through the controller. Rails also doesn't separate components on a page. Rather, you can edit all the components in a file on one page. If you have to store a lot of data, it would be better to use Rails. Otherwise, if you want a website that's immediately dynamic, React would be better.
What was a challenge you were able to overcome on this assignment? There's a lot of ways to do things and places you could put the logic. It's sometimes difficult to decide what goes where. Also, understanding how to use this in arrow function on the class vs inside the render.

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?
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.

@droberts-sea
Copy link

Litter Patrol

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene yes
Comprehension questions you need to work on the CS Fun questions!
Functionality
Clicking on litter or nature shows a check or X respectively yes
Clicking on litter appropriately updates the score yes
Under the Hood
JavaScript is well-organized and easy to read yes
Functions are named appropriately mostly - some variable names are a little odd.
Callback functions are passed to components appropriately yes
Overall Good work overall!


changedToCheck = () => {
if (!this.state.checked){

Choose a reason for hiding this comment

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

This reads state.checked, but in the rest of your code you're looking at _checked. That means that this code will always run, and you can continue to click on already-clicked items and get more points.

this.state = {
_checked: false,
_divClass: "game-item"
}

Choose a reason for hiding this comment

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

Generally you should only prefix variable names with _ if you're writing getters and setters for them.

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