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
Copy file name to clipboardExpand all lines: src/routes/reference/jsx-attributes/use.mdx
+17-7Lines changed: 17 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,21 +25,21 @@ description: >-
25
25
```ts
26
26
typeAccessor<T> = () =>T;
27
27
28
-
function directive(element:HTMLElement, accessor:Accessor<any>):void;
28
+
function directive(element:Element, accessor:Accessor<any>):void;
29
29
```
30
30
31
31
## Value
32
32
33
33
-**Type:** directive argument
34
34
35
-
Value exposed to the directive through its accessor.
35
+
Value exposed to the directive through an accessor.
36
+
When no explicit value is passed, the accessor returns `true`.
36
37
37
38
## Behavior
38
39
39
-
-`use:name={value}` calls the directive named `name` with the element and an accessor for `value`.
40
-
- Directive functions run during rendering before the element is connected to the DOM.
41
-
- Directives only work on native elements, including custom elements.
42
-
- Directives are not forwarded through user-defined components.
40
+
- The compiler lowers `use:name={value}` to a directive helper call with the element and an accessor for `value`. Without an explicit value, the accessor returns `true`.
41
+
- The directive runs during rendering before the element is connected to the DOM.
42
+
-`use:*` works only on native elements, including custom elements, and is not forwarded through user-defined components.
0 commit comments