Should state be an object returned by a function and what are the benefits? #712
jordyvandomselaar
started this conversation in
4. General
Replies: 1 comment 1 reply
-
@jordyvandomselaar - using a function ensures that the component gets a fresh set of data when being created, similar to how Vue uses a The function approach also allows you to compose the data, meaning you could have |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the docs we can see this snippet:
But this also works:
Are there benefits to using a function or is using a plain object fine as well?
Beta Was this translation helpful? Give feedback.
All reactions