Muhammad Hamza f0209c786f
Prepare for Yew 0.20 (#2973)
* 0.20 Changelog

* Improve changelog generator

* Add blog post

* Add blog post

* Apply suggestions from code review

Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com>
Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>

* update Changelog

* update Cargo.toml

* changelog gen compiles

* website version 0.20

* add migration guides

* prettier

* i18n

Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com>
Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>
2022-11-25 15:19:07 +05:00

22 lines
849 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.
:::
## Further Reading
- [use_node_ref hook](https://yew-rs-api.web.app/next/yew/functional/fn.use_node_ref.html)
- [`node_refs` example](https://github.com/yewstack/yew/tree/master/examples/node_refs)