Skip to content

Instantly share code, notes, and snippets.

@hieuhani
Last active May 25, 2017 04:53
Show Gist options
  • Save hieuhani/2e30057fd43899467fe016ab6df9c242 to your computer and use it in GitHub Desktop.
Save hieuhani/2e30057fd43899467fe016ab6df9c242 to your computer and use it in GitHub Desktop.
// Nhan ket qua la 1 array
return state.set('menus', fromJS(payload.menus));
// Them phan tu
return state.set('menus', state.get('menus').push(fromJS(payload.menu)));
// Update 1 phan tu
return state
.set('sets', state.get('sets').map((setItem) => {
if (setItem.get('id') === payload.set.id) {
return fromJS(payload.set)
}
return setItem;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment