Last active
December 19, 2017 05:33
-
-
Save eliath/6fc2fa3642eb3b08162777b46112c734 to your computer and use it in GitHub Desktop.
Dux Template
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
import update from 'immutability-helper' | |
import { createSelector } from 'reselect' | |
export const prefix = 'componentPrefix' | |
/* Action Types */ | |
export const ACTION = `${prefix}/ACTION` | |
/* Actions */ | |
export const doAction = param => | |
({ type: ACTION, param }) | |
/* Reducer */ | |
export const initialState = { | |
} | |
export default (state = initialState, action) => { | |
switch (action.type) { | |
default: | |
return state | |
} | |
} | |
/* Selectors */ | |
export const getComponentData = state => state[prefix] | |
export const getField = createSelector( | |
getComponentData, | |
data => data.field | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment