Replies: 2 comments 2 replies
-
I prefer to call navigation in actions, because "current page" is also state. Show / hide confirmation dialog is also state. There is a related article from the Mobx author: https://michel.codes/blogs/ui-as-an-afterthought |
Beta Was this translation helpful? Give feedback.
-
All state on frontend is somehow UI related. If you won't display anything, you won't need any state. |
Beta Was this translation helpful? Give feedback.
-
I am refactoring MobX in large-scale applications. Since it is big, making the code clean is very important.
There is an
action
that does the following (simplified):I am worried whether the
#1
and#2
are OK or not. The reason is that, IMHO mobx has aUI - action - state
triad (as is seen in the figure below by the mobx book). Thus,Action
s should modify theState
instead of theUI
directly. But in#1
, theAction
directly shows a dialog - which isUI
; in#2
, theAction
directly navigates to another page - which is also UI related.In short, can MobX's
action
s directly "touch" and manipulate theui
s?I have made some searches about this and is quite confused now. Thanks for any suggestions!
Remark: I tag it as both Flutter and JavaScript, because indeed I am using Flutter but this question applies to the JS version of MobX as well.
Remark: Following is the diagram from the mobx book.
Beta Was this translation helpful? Give feedback.
All reactions