chore: move CLI into its own "studio" app
This commit is contained in:
1 parent
207784800d
commit
fd7933561f
37 files changed
-1481
No files matched your search
@@ -1,9 +0,0 @@
|
||||
[package]
|
||||
name = "dioxus-router"
|
||||
version = "0.0.0"
|
||||
authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
@@ -1,40 +0,0 @@
|
||||
# Router hook for Dioxus apps
|
||||
|
||||
Dioxus-router provides a use_router hook that returns a different value depending on the route.
|
||||
The router is generic over any value, however it makes sense to return a different set of VNodes
|
||||
and feed them into the App's return VNodes.
|
||||
|
||||
Using the router should feel similar to tide's routing framework where an "address" book is assembled at the head of the app.
|
||||
|
||||
Here's an example of how to use the router hook:
|
||||
|
||||
```rust
|
||||
static App: FC<()> = |cx| {
|
||||
|
||||
// Route returns the associated VNodes
|
||||
// This hook re-fires when the route changes
|
||||
let route = use_router(cx, |router| {
|
||||
router.at("/").get(|path| {
|
||||
rsx!{ <LandingPage /> }
|
||||
});
|
||||
router.at("/shoes/:id").get(|path| {
|
||||
let id: Uuid = path.parse().unwrap();
|
||||
rsx!{ <ShoesPage id=id /> }
|
||||
});
|
||||
router.at("/pants/:id").get(|path| {
|
||||
let id: Uuid = path.parse().unwrap();
|
||||
rsx!{ <PantsPage id=id /> }
|
||||
});
|
||||
});
|
||||
|
||||
cx.render(rsx!{
|
||||
div {
|
||||
Navbar {}
|
||||
{route}
|
||||
Footer {}
|
||||
}
|
||||
})
|
||||
};
|
||||
```
|
||||
|
||||
Currently, the router is only supported in a web environment, but we plan to add 1st-party support via the context API when new renderers are available.
|
||||
@@ -1,7 +0,0 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user