You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the setup function receives (props, context). Components won't always be fed props from the parent, but will always need the context, therefore I reason that the props argument must be made optional and context must be provided as the first argument.
What this solves:
Mainly developer experience eg:
setup(_,{ emit }){
...
}
Can become:
setup({ emit }){
...
}
Avoiding redundant exclusion of props if not supplied by parent and developer has choice to access it or not.
The text was updated successfully, but these errors were encountered:
Components won't always be fed props from the parent but will always need the context
That isn't true. You probably found yourself using the context but not the props multiple times and thought that but the opposite happens quite often as well. Remember this library is following the RFC at https://vue-composition-api-rfc.netlify.com/api.html#setup. The order has probably been discussed already but it's impossible for me to link you to the comments as there were way too many at vuejs/rfcs#42 and vuejs/rfcs#78.
Props are like function parameters, it makes sense for them to be first, since you shouldn't destructure them and access them through the parameter props directly, renaming it to _ only changes something during development.
Currently the setup function receives
(props, context)
. Components won't always be fed props from the parent, but will always need the context, therefore I reason that the props argument must be made optional and context must be provided as the first argument.What this solves:
Mainly developer experience eg:
Can become:
Avoiding redundant exclusion of props if not supplied by parent and developer has choice to access it or not.
The text was updated successfully, but these errors were encountered: