-
Notifications
You must be signed in to change notification settings - Fork 1
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
Creates a new fillBoard array as it's not immutable. #1
base: main
Are you sure you want to change the base?
Conversation
pages/index.js
Outdated
setBoard([ | ||
Array(7).fill(null), | ||
Array(7).fill(null), | ||
Array(7).fill(null), | ||
Array(7).fill(null), | ||
Array(7).fill(null), | ||
Array(7).fill(null), | ||
Array(7).fill(null), | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why my commit hasn't pulled through but this should be setBoard([...fillBoard])
Who's turn? Player {winner ? `${winner} wins` : player} | ||
<button className="new-game" onClick={() => setGame({})}> | ||
New game | ||
{/* <MovesProvider> */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took out the MovesProvider because you aren't using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, I'm saving for that for later :) Thanks for the help!
Board is being passed in as a prop to your setGame, even when you pass in an empty object.
You can see this if you console.log the props in setGame.
:)