Have ideas to improve npm?Join in the discussion! ¬Ľ

    @async-resource/redux
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.1¬†‚Äʬ†Public¬†‚Äʬ†Published

    @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'))

    Install

    npm i @async-resource/redux

    DownloadsWeekly Downloads

    5

    Version

    0.2.1

    License

    MIT

    Unpacked Size

    31.3 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar