Vue · Senior · Question 44 of 75
What is the difference between $subscribe and a watch on store state?
- ✓Correct answer:
$subscribefires once per$patch(not per property) and receives mutation info; it can be detached from the component with{ detached: true } - 2They are identical
- 3
$subscribeonly works in devtools
Explanation
Subscriptions added inside a component are removed when it unmounts unless detached is set. $onAction is the equivalent for actions.