B
B
BonBon Slick2020-04-21 19:21:35
redux
BonBon Slick, 2020-04-21 19:21:35

Correct way to update the state of module B when module A changes?

Example, I delete the comment, it is deleted on the server and on the UI.
Now we need to update the comment counter for the post, and this is a state in another module.

1 - cause a mutation of another module in the action of the module where eg B actions -> mutate A is being removed
2 - call the action of the module from the pomponent upon completion of the operation
3 - emit the event and listen to a specific event
4 - monitor the changes in the length of the comment list in the counter component

Possible and other options, which is preferable, when and why?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question