polish: clean up the core crate
This commit is contained in:
1 parent
1e4a599d14
commit
e6c6bbdc1e
15 files changed
+760
-434
No files matched your search
@@ -22,3 +22,28 @@ async fn main() -> tide::Result<()> {
|
||||
|
||||
Dioxus LiveView runs your Dioxus apps on the server
|
||||
|
||||
|
||||
|
||||
```rust
|
||||
use soyuz::prelude::*;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let mut app = soyuz::new();
|
||||
app.at("/app").get(websocket(handler));
|
||||
app.listen("127.0.0.1:8080").await.unwrap();
|
||||
}
|
||||
|
||||
async fn order_shoes(mut req: WebsocketRequest) -> Response {
|
||||
let stream = req.upgrade();
|
||||
dioxus::liveview::launch(App, stream).await;
|
||||
}
|
||||
|
||||
fn App(cx: Context, props: &()) -> Element {
|
||||
let mut count = use_state(cx, || 0);
|
||||
cx.render(rsx!(
|
||||
button { onclick: move |_| count += 1, "Incr" }
|
||||
button { onclick: move |_| count -= 1, "Decr" }
|
||||
))
|
||||
}
|
||||
```
|
||||
Reference in new issue
Block a user