Skip to content

Instantly share code, notes, and snippets.

@C-E-Rios
C-E-Rios / manageReactState.js
Last active October 12, 2020 10:18
Managing state with hooks and context
function countReducer(state, action) {
switch (action.type) {
case "INCREMENT": {
return { count: state.count + 1 };
}
default: {
throw new Error(`Unsupported action type: ${action.type}`);
}
}
}

Keybase proof

I hereby claim:

To claim this, I am signing this object: