Skip to content

Sending child actions directly from the parent to update the child #1952

Discussion options

You must be logged in to vote

Hi @iwt-sebastian-boldt, neither of the styles you have sketched out is recommended in TCA.

First, actions should be named after what the user did in the UI, not what you want to do inside the reducer. So the action .didPressButton is clear and concise because the user just did something in the UI. However, .update is opaque and no one unfamiliar with the intricacies of the child domain will know when that action should be sent.

Further, you should not think of actions as just weird kinds of methods defined for your domain. They are not methods, but instead a concrete description of things that can happen in the UI, and sending actions is a lot more expensive than calling methods. We have…

Replies: 4 comments 25 replies

Comment options

You must be logged in to vote
22 replies
@lukeredpath
Comment options

@jerryga
Comment options

@lukeredpath
Comment options

@kawynfurstoss
Comment options

@kevinanderson7
Comment options

Answer selected by iwt-sebastian-boldt
Comment options

You must be logged in to vote
3 replies
@acosmicflamingo
Comment options

@lukeredpath
Comment options

@acosmicflamingo
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet