Global state 39 / 42
In main.js
we can also define data, methods, computed, etc.
These can then be accessed from any component using this.$root
(or just $root
in the template).
As with all things global, use this feature with care.
The Update username
button is currently broken in the example. Try adding a $root
method to update the username.