-
Notifications
You must be signed in to change notification settings - Fork 537
Closed
Labels
Description
What problem does this feature solve?
Not unwrappable refs will be able to passed as values to custom directives without loosing their essence
I was building a custom directive that needs a ref as a value, to then perform some changes to that ref in response to some events.
I was just experimenting, nothing too serious, but unfortunately I later realized that the automatic refs unwrapping when a ref is used inside a template will always prevents the creation of this kind of directives.
We are forced to use reactive to create a sort of notUnwrappableRef and for consistency we end up creating a reactive object with only one reactive property: value.
What does the proposed API look like?
Something like the following, but standardized for every user
import { reactive } from "vue"
export function notUnwrappableRef(value) {
return reactive({ value })
}Reactions are currently unavailable