@async-resource/redux

High-Level Resource Manager for Flux Architecure

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@async-resource/redux
Minified + gzip package size for @async-resource/redux in KB

Readme

@async-resource/redux

Installation

npm install --save @async-resource/redux

Usage

import connectResource, {
  consumeAction,
  reducers,
  registerResource,
  applyResourceToStore,
} from '@async-resource/redux'

// use it with https://github.com/ioof-holdings/redux-dynamic-reducer
// to add reducers dynamically
export const store = createStore(combineReducers({}))
const { registerResource: registerDynamicResource } = connectResource(store)
registerResource('user', {
  source: () => axios.get('/rest/user-info'),
})


// or use with a constant store
registerResource('user', {
  source: () => axios.get('/rest/user-info'),
})
export const store = createStore(combineReducers(reducers))
applyResourceToStore(store)


// interact with redux
store.dispatch(consumeAction('user'))

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.