mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
* Add a note telling how to bypass the recursion limit of the html! macro. * Update src/concepts/html/README.md Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com> * Update src/concepts/html/README.md Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com> Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
| description |
|---|
| The procedural macro for generating HTML and SVG |
Using html!
The html! macro allows you to write HTML and SVG code declaratively. It is similar to JSX a Javascript extension which allows you to write HTML code inside of Javascript.
Important notes
- The
html!macro only accepts one root html nodeyou can counteract this by [using fragments or iterators](lists.md) - An empty
html! {}invocation is valid and will not render anything - Literals must always be quoted and wrapped in braces:
html! { "Hello, World" }{% hint style="info" %} Thehtml!macro can reach easily the default recursion limit of the compiler. It is advised to bump its value if you encouter compilation errors. Use an attribute like#![recursion_limit="1024"]to bypass the problem. See the official documentation and this Stack Overflow question for details. {% endhint %}
{% page-ref page="lists.md" %}
{% page-ref page="elements.md" %}
{% page-ref page="literals-and-expressions.md" %}
{% page-ref page="components.md" %}