Releases: erikras/multireducer
Releases · erikras/multireducer
v3.1.0
v3.0.3
v3.0.2
v3.0.1
v3.0.0
This is a whole new rewrite version.
For the migration guide, please see https://github.com/erikras/multireducer/releases/tag/v3.0.0-beta2
v3.0.0-beta3
Export wrapDispatch
instead of wrapAction
, you can use wrapDispatch
to wrap redux's dispatch then dispatch action manually.
import { wrapDispatch } from 'multireducer'
import { add } from './actions/list'
wrapDispatch(dispatch, 'additional')(add)
v3.0.0-beta2
This is a whole new rewrite version.
Breaking changes
connectMultireducer
has been removed, you can usereact-redux
'sconnect
directly.multireducerBindActionCreators
has been renamed tobindActionCreators
.
Migration Guide
Version 2
import React, { Component, PropTypes } from 'react';
import { connectMultireducer } from 'multireducer';
import { add, remove } from './actions/list';
const mapStateToProps = (key, state) => ({ list: state.listCollection[key] });
const mapDispatchToProps = {add, remove};
ListComponent = connectMultireducer(
mapStateToProps,
mapDispatchToProps
)(ListComponent);
export default ListComponent;
render() {
return (
<div>
<h1>Lists</h1>
<ListComponent multireducerKey="proposed"/>
<ListComponent multireducerKey="scheduled"/>
<ListComponent multireducerKey="active"/>
<ListComponent multireducerKey="complete"/>
</div>
);
}
Version 3
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux'; // <= use react-redux's connect directly
import { bindActionCreators } from 'multireducer'; // <= use multireducer's version of bindActionCreators
import { add, remove } from './actions/list';
const mapStateToProps = (state, { as }) => ({ list: state.listCollection[as] }); // <= access state by multireducer key
const mapDispatchToProps = (dispatch, { as }) => bindActionCreators({ add, remove }, dispatch, as); // <= pass multireducer key to bindActionCreators
ListComponent = connectMultireducer(
mapStateToProps,
mapDispatchToProps
)(ListComponent);
export default ListComponent;
render() {
return (
<div>
<h1>Lists</h1>
{/* you can name the multireducer key whatever you want, it's 'as' in this example */}
<ListComponent as="proposed"/>
<ListComponent as="scheduled"/>
<ListComponent as="active"/>
<ListComponent as="complete"/>
</div>
);
}
v2.0.0
- Added thunk support! Thanks to @jsdmc and @adailey14 for their contributions.
Breaking Changes
v1.0.x
mapStateToProps()
took the reducer's state as its only parameter.
v2.x
mapStateToProps()
takes the reducer's key, the entire state, and an optional ownProps
parameter, much like react-redux
's connect()
function.
For more details, see PR #103 and the README.
This is how the react-redux-universal-hot-example
was migrated.
v1.0.2
☑️ Added support for [email protected]
with peer dep.