I know correctly that I have an index file in which I import different files with action creators for different views:
import generalActions from './generalActions'
import vftActions from './vftActions'
import shareActions from './shareActions'
import codeFormActions from './codeFormActions'
import signupActions from './signupActions'
const actions = {
...generalActions,
...vftActions,
...shareActions,
...codeFormActions,
...signupActions
}
export default actions
And then every time I import an action index with all the actions:
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import actions from '../../redux/actions'
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(actions, dispatch)
}
}
export default connect(null, mapDispatchToProps)(ContainerComponent)
Well, if I separate it in different exports and import only the creators of the actions that my container needs?
In addition, it is very likely that when I have many action creators, it will be difficult to find names that have not been accepted.
What do you think is the best aproach?
source
share