Skip to content

Instantly share code, notes, and snippets.

@eliath
Last active December 19, 2017 05:33
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 eliath/6fc2fa3642eb3b08162777b46112c734 to your computer and use it in GitHub Desktop.
Save eliath/6fc2fa3642eb3b08162777b46112c734 to your computer and use it in GitHub Desktop.
Dux Template
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