Skip to content

a small, standalone es6 module for combining redux reducers

License

Notifications You must be signed in to change notification settings

dominikstoetter/combine-reducers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

combine-reducers

(for redux)

a standalone ES6 combine-reducers function. Unit tested. Babel pre-configured.

yarn run v1.3.2
$ jest --coverage
 PASS  test/combine-reducers.test.js
  combineReducers
    ✓ should add a customer and a pony into eachs state (3ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        0.895s, estimated 1s
Ran all test suites.
---------------------|----------|----------|----------|----------|----------------|
File                 |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
---------------------|----------|----------|----------|----------|----------------|
All files            |      100 |        0 |      100 |      100 |                |
 combine-reducers.js |      100 |        0 |      100 |      100 |              1 |
---------------------|----------|----------|----------|----------|----------------|
✨  Done in 1.88s.

Example

import combineReducers from 'combine-reducers'

const reducerCustomers = (state = [], action) => action.type === 'SET_CUSTOMER' ? {
	customer: action.customer
} : state
const reducerPonys = (state = [], action) => action.type === 'SET_PONY' ? {
	pony: action.pony
} : state

const combinedReducers = combineReducers({
			reducerCustomers,
			reducerPonys
		});

About

a small, standalone es6 module for combining redux reducers

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published