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

Creates a new fillBoard array as it's not immutable. #1

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

Conversation

doingandlearning
Copy link

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.

:)

pages/index.js Outdated
Comment on lines 32 to 40
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),
])
Copy link
Author

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> */}
Copy link
Author

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.

Copy link
Owner

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!

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