Skip to content

Instantly share code, notes, and snippets.

@ctrlplusb
Created November 5, 2018 17:54
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 ctrlplusb/0898e4186f3d15c6dc1f5044abaf0df5 to your computer and use it in GitHub Desktop.
Save ctrlplusb/0898e4186f3d15c6dc1f5044abaf0df5 to your computer and use it in GitHub Desktop.
Easy peasy model with action
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