When defining a component, data
must be declared as a function that returns the initial data object, because there will be many instances created using the same definition. If we still use a plain object for data
, that same object will be shared by reference across all instances created! By providing a data
function, every time a new instance is created, we can simply call it to return a fresh copy of the initial data.