How to use the redux-actions.createActions function in redux-actions

To help you get started, we’ve selected a few redux-actions 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 performant-software / DM / src / main / resources / static / js / main.js View on Github external
/* global require */
const { applyMiddleware, createStore, compose } = require("redux");
const { logger } = require("redux-logger");
const { createActions, handleActions } = require("redux-actions");

const { ProjectChangeListener } = require("./project");

const actions = createActions(
    "USER_LOGGED_IN",
    "PROJECT_SELECTED",
    "RESOURCES_CHANGED",
    "RESOURCE_SELECTED",
    "DATA_SYNCHRONIZED"
);

const reducer = handleActions({

    [actions.userLoggedIn]: (state, action) => ({
        ...state,
        user: action.payload
    }),

    [actions.projectSelected]: (state, action) => ({
        ...state,
github phanhoangloc / react-native-boilerplate / src / modules / Language / Language.reducer.js View on Github external
// @flow
import { createActions } from 'redux-actions'
import typeToReducer from 'type-to-reducer'

import I18n from '../../i18n'

const actions = createActions('SET_LANGUAGE')

const initialState: string = I18n.currentLocale()
const reducer = typeToReducer(
  {
    [actions.setLanguage]: (state, action) => action.payload
  },
  initialState
)

export { actions }
export default reducer

redux-actions

Flux Standard Action utlities for Redux

MIT
Latest version published 5 months ago

Package Health Score

78 / 100
Full package analysis