chore: rename all &cx to cx, make clipppy happy
This commit is contained in:
1 parent
e8133e9449
commit
4eefc3f854
85 files changed
+256
-271
No files matched your search
@@ -36,7 +36,7 @@ fn BlogList(cx: Scope) -> Element {
|
||||
}
|
||||
|
||||
fn BlogPost(cx: Scope) -> Element {
|
||||
let id = use_route(&cx).segment("id")?;
|
||||
let id = use_route(cx).segment("id")?;
|
||||
|
||||
log::trace!("rendering blog post {}", id);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ fn simple_test() {
|
||||
}
|
||||
|
||||
fn BlogPost(cx: Scope) -> Element {
|
||||
let _id = use_route(&cx).parse_segment::<usize>("id")?;
|
||||
let _id = use_route(cx).parse_segment::<usize>("id")?;
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
|
||||
@@ -89,7 +89,7 @@ You must provide a valid URL `{scheme}://{?authority}/{?path}`.
|
||||
|
||||
```rust
|
||||
Router {
|
||||
initial_url: "https://dioxuslab.com/blog", // Set the initial url.
|
||||
initial_url: "https://dioxuslab.com/blog", // Set the initial url.
|
||||
Link { to: "/", "Home" },
|
||||
Link { to: "/blog", "Blog" }, // The router will render this route.
|
||||
}
|
||||
@@ -109,7 +109,7 @@ For any route, you can get a handle the current route with the `use_route` hook.
|
||||
|
||||
```rust
|
||||
fn Title(cx: Scope) -> Element {
|
||||
let route = use_route(&cx);
|
||||
let route = use_route(cx);
|
||||
|
||||
assert_eq!(route.segments(), &["dogs", "breeds", "yorkie", "hugo"]);
|
||||
|
||||
@@ -130,7 +130,7 @@ Router {
|
||||
}
|
||||
|
||||
fn BlogPost(cx: Scope) -> Element {
|
||||
let route = use_route(&cx);
|
||||
let route = use_route(cx);
|
||||
|
||||
match route.segment("post").and_then(parse) {
|
||||
Some(post) => cx.render(rsx!{ div { "Post {post}" } })
|
||||
@@ -168,7 +168,7 @@ Listeners can also be attached downstream in your app with the `RouteListener` h
|
||||
|
||||
```rust
|
||||
fn TitleCard(cx: Scope) -> Element {
|
||||
let (title, set_title) = use_state(&cx, || "First");
|
||||
let (title, set_title) = use_state(cx, || "First");
|
||||
|
||||
cx.render(rsx!{
|
||||
h1 { "render {title}" }
|
||||
|
||||
Reference in new issue
Block a user