stackoverfloweth
stackoverfloweth

Reputation: 6917

MapDispatchToProps include all actions

When using import * as MyActions from 'not/important'

Is it possible to then send all of MyActions to component props?

connect(mapStateToProps, { MyActions})(MyClass)

Upvotes: 0

Views: 91

Answers (1)

Dylan
Dylan

Reputation: 343

Yes, it's possible.

connect(mapStateToProps, MyActions)(MyClass)

Or if you want to include more actions from other places, you can use the spread operator ...:

connect(mapStateToProps, { action1, action2, ...MyActions })(MyClass)

Upvotes: 1

Related Questions