Skip to content

REACT Best Practices Actions

Patrick Alvin Luwum edited this page Jun 20, 2018 · 1 revision

Actions

1. Use bindActionCreators for dispatching actions Redux’s event dispatching system is the heart of its state management functionality. However, it can be tedious to pass down the dispatch function as a prop to every component that needs to dispatch an action.

Avoid this.

image

Avoid this.

image

instead do this

image

In the above code filterTalentPoolDataBySkills in bindActionCreators is available as this.props.filterTalentPoolDataBySkills to dispatch your action. It will make it easier to maintain the code for long run.