Rock - Nyckolle #60
Open
NLucuab wants to merge 3 commits into
Open
Conversation
spitsfire
reviewed
Jul 4, 2021
spitsfire
left a comment
There was a problem hiding this comment.
looks like you are on the right track! We need to pass your updateSquares function as a props through Board in order to get "X" and "O" to display.
The last thing is to show the winner, which it looks like you have in state. All we need to do is display it in the JSX. And your resetGame function looks ready to be used, too.
If you have time to work on this over break I'd encourage you to finish this up! You are almost there!
Comment on lines
+22
to
+38
| // let newArr = []; | ||
|
|
||
| // for(let i = 0; i < squares.length; i++) | ||
| // { | ||
| // newArr = newArr.concat(squares[i]); | ||
| // } | ||
|
|
||
| // // iterate over the new 1D array and insert the squares + id & value | ||
| // let squaresArr = []; | ||
| // for(let i = 0; i < newArr.length; i++) | ||
| // { | ||
| // const currentSquare = newArr[i]; | ||
| // squaresArr.push( <Square value= {currentSquare.value} id={currentSquare.id}/>) | ||
| // } | ||
| // return squaresArr; | ||
| // } | ||
|
|
There was a problem hiding this comment.
remember to get rid of unused code for the final submission
Suggested change
| // let newArr = []; | |
| // for(let i = 0; i < squares.length; i++) | |
| // { | |
| // newArr = newArr.concat(squares[i]); | |
| // } | |
| // // iterate over the new 1D array and insert the squares + id & value | |
| // let squaresArr = []; | |
| // for(let i = 0; i < newArr.length; i++) | |
| // { | |
| // const currentSquare = newArr[i]; | |
| // squaresArr.push( <Square value= {currentSquare.value} id={currentSquare.id}/>) | |
| // } | |
| // return squaresArr; | |
| // } |
Comment on lines
+17
to
+27
| // onClickCallback is passed to Square 1D array from Board.js | ||
| // gets called for the specific square that is clicked (hence id specification) | ||
| // const onSquareClick = () => { | ||
| // props.onClickCallback(props.id); | ||
| // }; | ||
| // // return button with onSquareClick called, with class specification for CSS | ||
| // return ( | ||
| // <button className='square' onClick={onSquareClick}> | ||
| // {props.value} | ||
| // </button> | ||
| // ); |
There was a problem hiding this comment.
Suggested change
| // onClickCallback is passed to Square 1D array from Board.js | |
| // gets called for the specific square that is clicked (hence id specification) | |
| // const onSquareClick = () => { | |
| // props.onClickCallback(props.id); | |
| // }; | |
| // // return button with onSquareClick called, with class specification for CSS | |
| // return ( | |
| // <button className='square' onClick={onSquareClick}> | |
| // {props.value} | |
| // </button> | |
| // ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds logic to turn in, will review example to make sure I understand what syntax does.