[IMP] hooks: useRef on component: set el anyway

Closes #437
This commit is contained in:
Aaron Bohy
2019-11-05 08:39:12 +01:00
committed by Géry Debongnie
parent af4f372506
commit 7e721a96b5
4 changed files with 113 additions and 91 deletions
+6 -2
View File
@@ -290,6 +290,7 @@ class Parent extends Component {
// here, if component is mounted, refs are active:
// - this.divRef.el is the div HTMLElement
// - this.subRef.comp is the instance of the sub component
// - this.subRef.el is the root HTML node of the sub component (i.e. this.subRef.comp.el)
}
}
```
@@ -297,8 +298,11 @@ class Parent extends Component {
As shown by the example above, html elements are accessed by using the `el`
key, and components references are accessed with `comp`.
Note: if used on a component, the reference will be set in the `refs`
variable between `willPatch` and `patched`.
Notes:
- if used on a component, the reference will be set in the `refs`
variable between `willPatch` and `patched`,
- on a component, accessing `ref.el` will get the root node of the component.
The `t-ref` directive also accepts dynamic values with string interpolation
(like the [`t-attf-`](qweb.md#dynamic-attributes) and