Skip to content

Instantly share code, notes, and snippets.

@surfer19
Last active September 27, 2020 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surfer19/050b786d61f77c503f0fb871b7aa7d65 to your computer and use it in GitHub Desktop.
Save surfer19/050b786d61f77c503f0fb871b7aa7d65 to your computer and use it in GitHub Desktop.
global-context.jsx
// context/global-context.jsx
export const reducer = (state, action) => {
switch (action.type) {
case "SAVE_LOGIN_INFO":
return {
...state,
email: action.email,
password: action.password
};
case "SAVE_PERSONAL_INFO":
return {
...state,
firstName: action.firstName,
surname: action.surname
};
default:
return {
...state
};
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment