Suddenly Redux
Simple Redux helpers.
npm install --save suddenly-redux
constants
Inside something like thing-actions.js
const constants = ;const Immutable = ; const Actions = ; Actions { // ...}; moduleexports = Actions;
queryString
Convert a javascript object to a query string.
const queryString = ; { query = ; return `/api/v1/things`;} ; // /api/v1/things?name=Nathan; // /api/v1/things
reducer
Define a reducer as (Action constant) keyed handlers.
const reducer = ;const Immutable = ;const Actions = ; const initial_state = Immutable; moduleexports = ;
combineReducers
This method simply wraps Redux Immutable's combineReducers
;
createStore
Creates a Redux store (with Thunk enabled by default).
const createStore = ;const Immutable = ; const reducer = ; let initial_state = Immutable;if typeof window !== "undefined" && window__STATE__ initial_state = Immutable; // Enable Hot reload for the reducerif processenvNODE_ENV !== 'production' && modulehot modulehotaccept'./reducers' { const replacement_reducer = ; store; }; const store = ; moduleexports = store;