For each component, I have the creators of file actions actions.js. And in it for ComponentOne, I have:
let actions = {
logSaying() {
console.log("Hi there");
}
}
export default actions
Then I have one main file of action creators and tried to combine all the actions into one sheet as follows:
import componentOneActions from './ComponentOne/actions'
let actions = {
componentOneActions,
}
export default actions
And pass actions to all components, such as from the main file of the action creators:
import actions from './actions'
...
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(actions, dispatch)
}
}
But none of the actions are transmitted when trying console.log(). Why is it not transmitted and how can I make one sheet of action creators? And is there really a better way to do this?
Thank you in advance and reply / accept the answer.
source
share