Action naming convention #1241
-
A small question I have from seeing #1240 What's the rationale for action names being written in the past participle tense instead of the present tense? case alertDismissed
// vs
case dismissAlert |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think it serves two different purposes. The first one is "informative", it says that an event has occurred and an action has been emitted accordingly, and you should perform relevant tasks in your reducer when you receive it, like cleaning up some state. In this specific case, this is a little tricky. The I personally think that both names are correct and can offer some contextual nuance in complex domains. I'm personally mixing both styles, as I feel that semantic correctness is preferable to stylistic consistency, and I feel very smug while writing this. It is even possible to imagine domains with a |
Beta Was this translation helpful? Give feedback.
I think it serves two different purposes. The first one is "informative", it says that an event has occurred and an action has been emitted accordingly, and you should perform relevant tasks in your reducer when you receive it, like cleaning up some state.
The second one is "imperative". The action bears an intent to do something. When you receive it in your reducer, you should perform the tasks required to realize the action.
In this specific case, this is a little tricky. The
.dismiss
action is emitted by the framework when the alert is dismissed by the system. This is not a request to dismiss the alert, but a signal emitted by the system that the user has finished interacting with the …