-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore.js
34 lines (30 loc) · 945 Bytes
/
store.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React, {createContext, useReducer} from "react";
import { RootReducer } from './reducers'
import palavras from './palavras'
export const ROOT_STATE = {
gameStarted: false,
players: [
{name: "Equipe Cao", points: 0, animatedValue: 0},
{name: "Equipe Pino", points: 0, animatedValue: 0},
{name: "Equipe Peka", points: 0, animatedValue: 0},
{name: "Equipe Roca", points: 0, animatedValue: 0},
],
palavras: palavras,
categoria: "objetos",
tabuleiro: [],
playerTurn: 0,
turn: 0,
}
export const FUNCTIONS = {
movePlayer: function(n,animatedValue) { }
}
const Store = ({children}) => {
const [ROOT_STATE, ROOT_DISPATCH] = useReducer(RootReducer, ROOT_STATE);
return (
<Context.Provider value={[ROOT_STATE, ROOT_DISPATCH]}>
{children}
</Context.Provider>
)
};
export const Context = createContext(ROOT_STATE);
export default Store;