How to use the reduxsauce.createActions function in reduxsauce

To help you get started, we’ve selected a few reduxsauce examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Twotalltotems / react-native-paginatable / PaginationStateManager.js View on Github external
addAction({ type, payload, handler }) {
		let handlerName = type
			.split(/(?=[A-Z])/)
			.join('_')
			.toUpperCase()

		this.actionObject[type] = payload
		const { Types, Creators } = createActions(this.actionObject, {
			prefix: `${this.name.toUpperCase()}_`
		})

		this.actionTypes = Types
		this.actions = Creators

		this.actionHandlers[Types[handlerName]] = handler

		Object.getPrototypeOf(this)[type] = args => {
			return dispatch => {
				dispatch(this.actions[type].apply(null, Object.values(args)))
			}
		}
	}
github Twotalltotems / react-native-paginatable / src / Components / PaginatableList / PaginationStateManager.js View on Github external
addAction({ type, payload, handler }) {
        let handlerName = type.split(/(?=[A-Z])/).join('_').toUpperCase();

        this.actionObject[type] = payload
        const { Types, Creators } = createActions(this.actionObject, { prefix: `${this.name.toUpperCase()}_` })
    
        this.actionTypes = Types
        this.actions = Creators

        this.actionHandlers[Types[handlerName]] = handler

        Object.getPrototypeOf(this)[type] = (args) => {
            return (dispatch) => {
                dispatch(this.actions[type].apply(null, Object.values(args)))
            }
        }
    }
github RobPando / redux-offline-queue / src / offlineActions.js View on Github external
export function createOfflineActions(config) {
  const { Types, Creators } = createActions(config)

  const OfflineCreators = _mapValues(Creators, (creator) => {
    return appendOfflineMeta(creator)
  })

  return {
    Types,
    Creators: OfflineCreators,
  }
}
github Twotalltotems / react-native-paginatable / src / Components / PaginatableList / PaginationStateManager.js View on Github external
constructor(name, url) {
        this.name = name
        this.endpointUrl = url
        this.initialState = {
            items: []
        }

        this.actionObject = {
            'loadMore'  : ['newItems'],
            'refresh'   : ['newItems']
        }

        const { Types, Creators } = createActions(this.actionObject, { prefix: `${name.toUpperCase()}_` })

        this.actionTypes = Types
        this.actions = Creators

        this.actionHandlers = {
            [Types['LOAD_MORE']]: (state, { newItems }) => {
                return {
                    ...state,
                    items: state.items.concat(newItems)
                }
            },
            [Types['REFRESH']]: (state, { newItems }) => {
                return {
                    ...state,
                    items: newItems
                }
github Twotalltotems / react-native-paginatable / PaginationStateManager.js View on Github external
this.onParsePaginationResponse = onParsePaginationResponse
		this.customizedReducerPath = customizedReducerPath
		this.getHeaders = requestHeaders

		this.initialState = {
			items: []
		}

		this.actionObject = {
			loadMore: ['newItems'],
			refresh: ['newItems'],
			reset: [],
			setTotalPage: ['totalPagesNumber']
		}

		const { Types, Creators } = createActions(this.actionObject, {
			prefix: `${name.toUpperCase()}_`
		})

		this.actionTypes = Types
		this.actions = Creators

		this.actionHandlers = {
			[Types['LOAD_MORE']]: (state, { newItems }) => {
				return {
					...state,
					items: state.items.concat(newItems)
				}
			},
			[Types['REFRESH']]: (state, { newItems }) => {
				return {
					...state,

reduxsauce

Some aesthetic toppings for your Redux meal.

MIT
Latest version published 12 months ago

Package Health Score

67 / 100
Full package analysis