Last active
April 2, 2022 12:35
-
-
Save antondevv/d00499e64d60becac73fd27570dbcbd5 to your computer and use it in GitHub Desktop.
reducer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const inititalState = { name: "User 1", age: 23 }; | |
const userReducer = (state = inititalState, action) => { | |
switch (action.type) { | |
case "CHANGEUSERNAME": { | |
return { ...state, name: action.payload }; | |
} | |
} | |
return state; | |
}; | |
export default userReducer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment