UseVDomRef provides a reference to a DOM element in the VDOM tree. It returns a VDomRef that can be attached to elements for direct DOM access. The ref will not be current on the first render - refs are set and become current after client-side mounting. This hook must be called within a component co
()
| 22 | // current after client-side mounting. |
| 23 | // This hook must be called within a component context. |
| 24 | func UseVDomRef() *vdom.VDomRef { |
| 25 | rc := engine.GetGlobalRenderContext() |
| 26 | val := engine.UseVDomRef(rc) |
| 27 | refVal, ok := val.(*vdom.VDomRef) |
| 28 | if !ok { |
| 29 | panic("UseVDomRef hook value is not a ref (possible out of order or conditional hooks)") |
| 30 | } |
| 31 | return refVal |
| 32 | } |
| 33 | |
| 34 | // TermRef wraps a VDomRef and implements io.Writer by forwarding writes to the terminal. |
| 35 | type TermRef struct { |
no test coverage detected