WorldSEnder cd5b8a520c
Improve grammar and paragraph structure in documentation (#2620)
* Read through the docs and correct spelling and grammar

* Run prettier

* Apply review suggestions

Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>

* adjust translation messages

Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>
2022-04-20 16:41:42 +05:00

21 lines
704 B
Plaintext

---
title: 'Node Refs'
description: 'Out-of-band DOM access'
---
The `ref` attribute can be used to attach the `NodeRef` to an HTML element. In callbacks,
you can then get the DOM `Element` that the ref is attached to. This can be used to make
changes to the DOM outside of the `view` lifecycle method, retrieve the value of an `<input>`
and other direct interactions with the DOM via the javascript API.
This is useful for getting ahold of canvas elements, or scrolling to different sections of a page.
:::caution
Do not manually modify the DOM tree that is rendered by Yew. Treat the `NodeRef` as a read-only
access, if you are unsure.
:::
## Example
See [use_node_ref hook](./hooks/use-node-ref)