bind to props by name as svelte
What problem does this feature solve?
when passing data to component as prop if it with same name as prop name it will be more prettiy if make short syntax as the following
<Component :data />
instead of
<Component :data="data"/>
What does the proposed API look like?
when passed data name same as the prop name why we repeat the same word?
We need an RFC for this proposal. Please create a discussion on https://github.com/vuejs/rfcs/discussions
It has already been discussed before in this PR. See Evan's comment on it. 👀
I do like the idea, and a lot of the community has proposed the same idea over the years at least 10 times (See the PR for references)
. Let's hope this feature lands someday in the future, even if it's only available as an opt-in feature.
By the time being you can do this v-bind
shorthand:
<Comp :="{ name }" />
But it's not the same nor as simple as it would be with the proposed syntax:
<Comp :name />
<!-- OR -->
<Comp ::name />