issues
search
DylanSp
/
tic-tac-toe-react
A simple client-side Tic-Tac-Toe app for learning/practicing React.
MIT License
0
stars
1
forks
source link
Rework state management
#39
Open
DylanSp
opened
2 years ago
DylanSp
commented
2 years ago
Install redux-toolkit (instructions -
https://redux-toolkit.js.org/introduction/getting-started#an-existing-app
)
Convert game logic to serializable plain object, instead of class
Root state has one piece - game state
Actions:
makeMove
(takes cell number),
startNewGame
(no parameters)
Rip out prop-drilling;
Cell
can dispatch
makeMove
,
NewGameButton
can dispatch
startNewGame
.
makeMove
(takes cell number),startNewGame
(no parameters)Cell
can dispatchmakeMove
,NewGameButton
can dispatchstartNewGame
.