1.0.17 • Published 10 years ago

redux-gatorade v1.0.17

Weekly downloads
5
License
MIT
Repository
github
Last release
10 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

10 years ago

1.0.16

10 years ago

1.0.15

10 years ago

1.0.14

10 years ago

1.0.13

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago