Scripts2026年4月12日·1 分钟阅读

Dioxus — Full-Stack App Framework for Web, Desktop, and Mobile

Dioxus is a full-stack app framework for Rust with a React-like API. Build web (WASM), desktop (native WebView), mobile (iOS/Android), TUI, and server-rendered apps from one codebase. Hooks, components, server functions, and hot reloading.

SC
Script Depot · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

cargo install dioxus-cli
dx new my_app
cd my_app
dx serve                                    # Web dev server
dx serve --platform desktop                 # Desktop
use dioxus::prelude::*;

fn main() {
    launch(App);
}

#[component]
fn App() -> Element {
    let mut count = use_signal(|| 0);

    rsx! {
        h1 { "Counter: {count}" }
        button { onclick: move |_| count += 1, "Increment" }
        button { onclick: move |_| count -= 1, "Decrement" }
    }
}
介绍

Dioxus is a full-stack app framework for Rust inspired by React. Write components with hooks and JSX-like syntax (rsx! macro), deploy to web (WASM), desktop (WebView), mobile (iOS/Android), TUI, and server. Created by Jonathan Kelley.

What Dioxus Does

  • React-like API — components, hooks, context, props
  • rsx! macro — JSX-like syntax in Rust
  • Multi-platform — web, desktop, mobile, TUI, server
  • Server functions — call server code from client (like Next.js server actions)
  • Signals — fine-grained reactivity
  • Hot reloading — rsx! changes reload instantly
  • Router — file-based or declarative routing
  • Fullstack — SSR, hydration, streaming

Comparison

Framework Language Platforms Reactivity
Dioxus Rust Web, Desktop, Mobile, TUI Signals
Leptos Rust Web (SSR + WASM) Signals
Yew Rust Web (WASM) VDOM
Tauri Rust + JS Desktop, Mobile Frontend FW
React JavaScript Web VDOM

常见问题 FAQ

Q: Dioxus vs Leptos? A: Dioxus 覆盖更多平台(desktop, mobile, TUI),API 更像 React;Leptos 专注 web,更像 SolidJS,SSR 更成熟。

Q: 生产就绪? A: v0.6+ 已经可以用于生产 web 项目。Desktop 和 Mobile 平台还在完善中。

来源与致谢 Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产