npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

redux-subspace-loop

3.0.1 • Public • Published

redux-subspace-loop

npm version npm downloads License: BSD-3-Clause

This library provides necessary utilities for supporting redux-subspace in projects using redux-loop.

Installation

npm install --save redux redux-loop redux-subspace redux-subspace-loop

Quick Start

import { createStore } from 'redux'
import { subspace } from 'redux-subspace'
import { install, combineReducers } from 'redux-loop'
import { namespaced } from 'redux-subspace-loop'
import { todoReducer, addTodo } from './todoApp'
import { counterReducer, increment, decrement } from './counterApp'
 
const rootReducer = combineReducers({
  todo: todoReducer
  counter1: namespaced('counter1')(counterReducer),
  counter2: namespaced('counter2')(counterReducer)
})
 
const store = createStore(rootReducer, install())
 
const todoStore = subspace((state) => state.todo)
const counter1Store = subspace((state) => state.counter1, 'counter1')
const counter2Store = subspace((state) => state.counter2, 'counter2')
 
todoStore.dispatch(addTodo('Use redux-subspace!'))
const todoState = todoStore.getState()
 
counter1Store.dispatch(increment())
const counter1State = counter1Store.getState()
 
counter2Store.dispatch(decrement())
const counter2State = counter2Store.getState()
 
const rootState = store.getState()

Documentation

Keywords

none

install

npm i redux-subspace-loop

Downloadsweekly downloads

60

version

3.0.1

license

BSD-3-Clause

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability