Skip to content

Instantly share code, notes, and snippets.

@jurgob
Last active March 19, 2016 00:25
Show Gist options
  • Save jurgob/08dd460a9b4d9555766d to your computer and use it in GitHub Desktop.
Save jurgob/08dd460a9b4d9555766d to your computer and use it in GitHub Desktop.
react utils - actions with utils
const createLayoutAction = createUpdateStateAction(‘LAYOUT’);
const getLayoutState = getReducerState(store, ‘LAYOUT’)
export const toogleEditorExpanded = () => {
const isEditorExpanded = !getLayoutState().isEditorExpanded;
return updateLayoutState({
isEditorExpanded
})
}
export const toogleLayoutDirection = () => {
const direction = getLayoutState().direction === 'vertical'
? 'horizontal'
: 'vertical'
return createLayoutAction({
direction
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment