Redux Polymorphic
Another attempt to reuse your reduers, inspired from multireducer
Installation
npm i --save redux-polymorphic
How It Works
STEP 1:
// In case you are using Immutable.js, you can:// import { polymorphicReducer } from 'redux-polymorphic/immutable' const reducer =
STEP 2:
static propTypes = list: PropTypesarrayisRequired { const add list remove = thisprops return <div> <button onClick= >Add</button> <ul> list </ul> </div> } ListComponent = ListComponent
STEP 3:
{ return <div> <h1>Lists</h1> <ListComponent as="proposed"/> <ListComponent as="scheduled"/> <ListComponent as="active"/> <ListComponent as="complete"/> </div> }
Manually dispatch
add