Skip to content

Don't dispatch directly from components #23

Closed
@dimaip

Description

If we use react-redux, it's considered a best practice to not to couple React components with Redux state logic like dispatch, React component should not be aware of the existence of Redux at all.

connect method from react-redux package receives second argument that maps array of callbacks to Redux action creators. So the component just exposes some callback and react-redux does the rest.
See https://github.com/rackt/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions