Flux Dispatcher - view actions against server actions

Is there any reason besides semantics for creating different sending methods for view and server actions? All the training materials and examples that I saw (especially this ) completely ignore the original constant when listening to sent payloads in favor of including the type of action of the payload.

I believe there is a reason why this model is common in thread examples, but I still don't see a specific example of why this is useful. Presumably, one could add an additional if or enable a payload source to determine whether to act in stores, but none of the examples I saw take this constant into account at all. Any thoughts on this would be greatly appreciated.

+5
source share
1 answer

Yes, it was a cool / cargo cultivation that appeared in a specific Flux project on Facebook, but there is no real reason for this. If you need to distinguish between server and view actions, you can simply give them different types or another property of the action itself to help differentiate them.

When I get the time, I plan to rewrite all the examples and documentation to reflect this.

+21
source

Source: https://habr.com/ru/post/1203840/


All Articles