mirror of https://github.com/yewstack/yew
parent
d74731c508
commit
84e882ead5
|
@ -180,12 +180,12 @@ The braces around the value can be ommited if the value is a literal.
|
|||
|
||||
Literals are all valid [literal expressions](https://doc.rust-lang.org/reference/expressions/literal-expr.html)
|
||||
in Rust. Note that [negative numbers are **not** literals](https://users.rust-lang.org/t/why-are-negative-value-literals-expressions/43333)
|
||||
and thus must be encosed in curly-braces `{-6}`
|
||||
and thus must be enclosed in curly-braces `{-6}`
|
||||
|
||||
:::
|
||||
|
||||
:::note Component properties
|
||||
Component properites are passed as Rust objects and are different from the element attributes/properties described here.
|
||||
Component properties are passed as Rust objects and are different from the element attributes/properties described here.
|
||||
Read more about them at [Component Properties](../function-components/properties.mdx)
|
||||
:::
|
||||
|
||||
|
@ -202,6 +202,26 @@ Currently, there are two such special props: `ref` and `key`.
|
|||
Read more at [Lists](./html/lists)
|
||||
:::
|
||||
|
||||
## Comments
|
||||
|
||||
It is also possible to use Rust style comments as part of the HTML structure:
|
||||
|
||||
```rust
|
||||
use yew::prelude::*;
|
||||
|
||||
html! {
|
||||
<>
|
||||
<h1>{ "My heading" }</h1>
|
||||
// here comes the content
|
||||
<main>
|
||||
{ "…" }
|
||||
</main>
|
||||
</>
|
||||
};
|
||||
```
|
||||
|
||||
Comments will be dropped during the parsing process and will not end up in the final output.
|
||||
|
||||
## Conditional Rendering
|
||||
|
||||
Markup can be rendered conditionally by using Rust's conditional structures. ' +
|
||||
|
|
Loading…
Reference in New Issue