Created
November 5, 2018 17:54
-
-
Save ctrlplusb/0898e4186f3d15c6dc1f5044abaf0df5 to your computer and use it in GitHub Desktop.
Easy peasy model with action
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 model = { | |
todos: { | |
items: [], | |
// 👇 an action | |
add: (state, payload) => { | |
state.items.push(payload); | |
} | |
}, | |
session: { | |
user: null | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment