Structure de données jeu client
This commit is contained in:
12
client/hooks/useGame.ts
Normal file
12
client/hooks/useGame.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { useAppDispatch, useAppSelector } from "./useStore"
|
||||
import { setPlayerId, updateMoney } from "@/utils/features/game/gameSlice"
|
||||
|
||||
export const useGame = () => useAppSelector((state) => state.game)
|
||||
export const useSetPlayerId = () => {
|
||||
const dispath = useAppDispatch()
|
||||
return (playerId: number) => dispath(setPlayerId(playerId))
|
||||
}
|
||||
export const useUpdateMoney = () => {
|
||||
const dispatch = useAppDispatch()
|
||||
return (money: number) => dispatch(updateMoney(money))
|
||||
}
|
Reference in New Issue
Block a user