SherylHohman / ReactND-C3-Project2-Readable

BSD 2-Clause "Simplified" License
1 stars 0 forks source link

suggestion: import all actions directly into the connect funciton #46

Open SherylHohman opened 6 years ago

SherylHohman commented 6 years ago

SUGGESTION 4/8 by reviewer2

Comments.js line 6

If you want to pass all the action creators from a specific module into your container, you can do so by first importing your actions utilizing the following import method:

import * as actions from ‘../actions/action1’;

The above selects ALL your actions within a specific action creator module, and adds them to the this.props object of your container

To assign your actions into your container, you can write the following:

export default connect(mapStateToProps, actions)(Component);

This adds all the action creators within the imported actions module to your container with less syntax