React Flux: what's the point of actions?
Asked Answered
F

1

2

In Flux, what is the point of using actions, instead of just letting the component publish directly to the dispatcher? What is it that I can't do without actions?

Fugleman answered 16/4, 2015 at 14:28 Comment(2)
There's nothing you couldn't do without actions, however, it's simply a pattern they've established to encourage a particular style of programming. facebook.github.io/flux/docs/overview.html Some might suggest they're more testable, but again, there are other ways of doing that.Portulaca
They form the API of the application. Collecting them in one place makes it easy to reuse them in different parts of the application.Liatris
U
3

The action creators decouple the component from the dispatcher. You could replace the dispatcher and related pieces with something else and the components would not need to change.

Unawares answered 16/4, 2015 at 16:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.