polish: change in cx to cx
This commit is contained in:
1 parent
0ded32e184
commit
9971ff215d
21 files changed
+426
-320
No files matched your search
@@ -113,9 +113,9 @@ pub static Example: FC<()> = |cx| {
|
||||
// rsx! is lazy, and the underlying closures cannot have the same type
|
||||
// Rendering produces the VNode type
|
||||
{match rand::gen_range::<i32>(1..3) {
|
||||
1 => rsx!(in cx, h1 { "big" })
|
||||
2 => rsx!(in cx, h2 { "medium" })
|
||||
_ => rsx!(in cx, h3 { "small" })
|
||||
1 => rsx!(cx, h1 { "big" })
|
||||
2 => rsx!(cx, h2 { "medium" })
|
||||
_ => rsx!(cx, h3 { "small" })
|
||||
}}
|
||||
|
||||
// Optionals
|
||||
@@ -128,7 +128,7 @@ pub static Example: FC<()> = |cx| {
|
||||
// Duplicating nodes
|
||||
// Clones the nodes by reference, so they are literally identical
|
||||
{{
|
||||
let node = rsx!(in cx, h1{ "TopNode" });
|
||||
let node = rsx!(cx, h1{ "TopNode" });
|
||||
(0..10).map(|_| node.clone())
|
||||
}}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ Sometimes you want a signal to propagate across your app, either through far-awa
|
||||
const TITLE: Atom<String> = || "".to_string();
|
||||
const Provider: FC<()> = |cx| {
|
||||
let title = use_signal(&cx, &TITLE);
|
||||
rsx!(in cx, input { value: title })
|
||||
rsx!(cx, input { value: title })
|
||||
};
|
||||
```
|
||||
|
||||
@@ -108,7 +108,7 @@ If we use the `TITLE` atom in another component, we can cause updates to flow be
|
||||
const Receiver: FC<()> = |cx| {
|
||||
let title = use_signal(&cx, &TITLE);
|
||||
log::info!("This will only be called once!");
|
||||
rsx!(in cx,
|
||||
rsx!(cx,
|
||||
div {
|
||||
h1 { "{title}" }
|
||||
div {}
|
||||
|
||||
Reference in new issue
Block a user