Skip to content

Water & Fire - Kayla & Ida#6

Open
idago123 wants to merge 10 commits intoAda-C14:masterfrom
idago123:master
Open

Water & Fire - Kayla & Ida#6
idago123 wants to merge 10 commits intoAda-C14:masterfrom
idago123:master

Conversation

@idago123
Copy link

@idago123 idago123 commented Dec 30, 2020

React Tic Tac Toe

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Prompt Response
How are events / event handlers and useState connected? useState may update when events are triggered by our onClick function.
What are two ways to do "dynamic styling" with React? When should they be used? 1. Inline Styling - While it’s a convenient way to condense code, it is not recommended. 2. Stylesheets - When we want to style any rendered code.
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 interacts with a web page via clicking or hovering over an element, it triggers a request to the app (which behind the scenes looks like a callback response to the event that was triggered). React will take that event and render a response to that specific request.

CS Fundamentals Questions

Question Answer
What do you think is the BigO complexity of the method you use to compute a winner? O(n) because we utilize only one loop to calculate and return the winner.
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.
Time complexity might be o(n) because the data structure we are passing through to the components are 2-d arrays.

}

const checkForWinner = (squares) => {
const winningCombos = [

Choose a reason for hiding this comment

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

This is a clever approach. Consider how you could also loop over the 2D array to check for matches on rows and columns.

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.

3 participants