[Vuejs]-I thought methods are not reactive but why in this example the method is reactive?

0👍

In the context of Vue, values’ being reactive means that their state (properties) are tracked and their setters are intercepted to trigger re-rendering.

Related part in docs

In contrast, methods of components are not reactive, because changing their properties doesn’t trigger re-rendering.

In your sample, you don’t change properties of iAmAMethod method, but you change the counter data which is reactive. That’s why Vue re-renders the template.

Leave a comment