const ACTIONS = {
INCREMENT:'inc',
DECREMENT:'dec'
}
const reducer = (state, action) => {
if(action.type === ACTIONS.INCREMENT){
return state + 1
}else if(action.type === ACTIONS.DECREMENT){
return state - 1
}
return state;
};
const [state , dispatch] = useReducer(reducer , inatialState = 0)
Login pageSignup pageHome pageList frindesAdd friend + invite friendJoin puplic gameCreate new gameGame roomGame show ruleGame room silent statusGame room discussionGame room voteGame room vote resultVictoryGame points + repeat game or back homeRank page
Nov 30, 2023grades
Sep 2, 2023index -> charts and statistics
Jul 24, 2023CORE MODULES GLOBALS global classes example (Math class) cont val = Math.abs(-5); global functions example (fetch) fetch('https://jsonplaceholder.typicode.com/todos/1') .then(response => response.json()) .then(json => console.log(json))
Jun 4, 2023or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up