Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bindActionCreators in mapDispatchToProps #30

Open
lextoc opened this issue Nov 6, 2018 · 2 comments · May be fixed by #57
Open

Allow bindActionCreators in mapDispatchToProps #30

lextoc opened this issue Nov 6, 2018 · 2 comments · May be fixed by #57

Comments

@lextoc
Copy link

lextoc commented Nov 6, 2018

The code below gives an eslint message:

function mapDispatchToProps(dispatch) {
  return bindActionCreators({
    homeAction,
  }, dispatch);
}

It says "mapDispatchToProps should return object". While this is true, the convenience method bindActionCreators should be allowed too:

Turns an object whose values are action creators, into an object with the
same keys, but with every function wrapped into a dispatch call so they
may be invoked directly. This is just a convenience method, as you can call
store.dispatch(MyActionCreators.doSomething()) yourself just fine.

dentuzhik added a commit to bolteu/eslint-plugin-react-redux that referenced this issue Dec 2, 2020
arturluik pushed a commit to bolteu/eslint-plugin-react-redux that referenced this issue Mar 16, 2021
dentuzhik added a commit to bolteu/eslint-plugin-react-redux that referenced this issue Oct 21, 2022
@brewster1134
Copy link

is this still in consideration? are there any known workarounds?

@brewster1134
Copy link

brewster1134 commented Jan 31, 2023

the syntax i am having an issue with is

const mapDispatchToProps = dispatch => {
  return bindActionCreators(
    {
      actionName: action
    },
    dispatch,
  );
};

is there a refactor to this is will pass linting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants