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

Mutating array #20

Open
mabarm opened this issue Jun 17, 2023 · 0 comments
Open

Mutating array #20

mabarm opened this issue Jun 17, 2023 · 0 comments

Comments

@mabarm
Copy link

mabarm commented Jun 17, 2023

/*
if (gameState[itemNumber] === 'empty') {
gameState[itemNumber] = isCross ? 'cross': 'circle'
setIsCross(!isCross)
}
*/
Isn't mutating the array which is a state violates the principles of react.
https://react.dev/learn/updating-arrays-in-state

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

No branches or pull requests

1 participant