1.0.4 • Published 4 years ago

redux-tidy v1.0.4

Weekly downloads
63
License
ISC
Repository
-
Last release
4 years ago

Redux-tidy

Simple helpers to organize your reducers

Provides two helper functions, makeReducer and organizeReducers

makeReducer(name: String, initialState: Object, transitions: Object)
organizeReducers(reducers: Array<reducer>, getAsFunctions: Boolean)

Usage

//reducer
import { makeReducer } from 'redux-tidy'

const NAME = 'fooReducer'
const SET = `${NAME}/set`

const initialState = { foo: bar }
const reducer = makeReducer(NAME, initialState, {
  [SET]: (state, action) => ({
    foo: action.payload
  })
})

//store
import { createStore, combineReducers } from 'redux'
import { organizeReducers } from 'redux-tidy'

const initialState = organizeReducers([reducer])
const reducers = combineReducers(organizeReducers([reducer], true))

createStore(
    reducers,
    initialState
  )
1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago