Skip to content

Commit 170b1b7

Browse files
author
Josh Story
committed
changed ConnectDecorator#bindActionCreators to ConnectDecorator#bindDispatch and updated corresponding method names. this is to avoid confusion with the redux utility bindActionCreators and the fact that the second argument doesn not have to necessarily be related to action creators in any way
1 parent 80ebc01 commit 170b1b7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/components/createConnectDecorator.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function createConnectDecorator(React) {
2121

2222
const subscribing = select ? true : false;
2323
const selectState = select || emptySelector;
24-
const bindActionCreators = isPlainObject(dispatchBinder) ? wrapActionCreators(dispatchBinder) : dispatchBinder;
24+
const bindDispatch = isPlainObject(dispatchBinder) ? wrapActionCreators(dispatchBinder) : dispatchBinder;
2525
const merge = mergeHandler;
2626

2727
return DecoratedComponent => class ConnectDecorator extends Component {
@@ -51,7 +51,7 @@ export default function createConnectDecorator(React) {
5151
super(props, context);
5252
this.state = {
5353
...this.selectState(props, context),
54-
...this.bindActionCreators(context)
54+
...this.bindDispatch(context)
5555
};
5656
}
5757

@@ -88,13 +88,13 @@ export default function createConnectDecorator(React) {
8888
return { slice };
8989
}
9090

91-
bindActionCreators(context = this.context) {
91+
bindDispatch(context = this.context) {
9292
const { dispatch } = context.store;
93-
const actionCreators = bindActionCreators(dispatch);
93+
const actionCreators = bindDispatch(dispatch);
9494

9595
invariant(
9696
isPlainObject(actionCreators),
97-
'The return value of `bindActionCreators` prop must be an object. Instead received %s.',
97+
'The return value of `bindDispatch` prop must be an object. Instead received %s.',
9898
actionCreators
9999
);
100100

0 commit comments

Comments
 (0)