1.0.17 • Published 8 years ago

redux-gatorade v1.0.17

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

Redux Gatorade - Keeping your application state hydrated

redux library that helps out in hydrating state from URL parameters

Installation

npm install --save redux-gatorade

What is included?

I. A higher-order reducer: HydrationReducer

HydrationReducer :: (Reducer, params) -> Reducer

import { combineReducers } from 'redux';
import { HydrationReducer } from 'redux-gatorade';
import appReducer from './appReducer';

const rootReducer = combineReducers({
  app: HydrationReducer(appReducer, ['promoCode', 'referralCode']),
  ...
  ...
  ...
});

NOTE: The new reducer returned by HydrationReducer() is now waiting for an action of type: 'redux-gatorade/HYDRATE_FROM_URL_PARAMS' to be dispatched; which will then add a property 'urlParameters' to the state object

{
  ...state,
  urlParameters: {
    promoCode: '10PERCENT_OFF',
    referralCode: 'foobar'
  }
}

II. Actions: 1) hydrateFromUrlParams() - which will dispatch action type of 'redux-gatorade/HYDRATE_FROM_URL_PARAMS'

import { HydrationActions } from 'redux-gatorade';

// hydrateFromUrlParams :: Object -> Action
HydrationActions.hydrateFromUrlParams({ promoCode: '10PERCENT_OFF', referralCode: 'foobar' });
// -> { type: 'redux-gatorade/HYDRATE_FROM_URL_PARAMS', payload: { promoCode: '10PERCENT_OFF', referralCode: 'foobar' } }

License

MIT, see LICENSE.md for more information.

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

8 years ago

1.0.14

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago