This change switches back to the original `ctx<props>` syntax for commponents. This lets lifetime elision to remove the need to match exactly which lifetime (props or ctx) gets carried to the output. As such, `Props` is currently required to be static. It *is* possible to loosen this restriction, and will be done in the future, though only through adding metadata about the props through the Props derive macro. Implementing the IS_STATIC trait is unsafe, so the derive macro will do it through some heuristics. For now, this unlocks sharing vnodes from parents to children, enabling pass-thru components, fragments, portals, etc.
Dioxus
This crate provides all the batteries required to build Dioxus apps.
Included in this crate is:
- Dioxus core
- Essential hooks (use_state, use_ref, use_reducer, etc)
- rsx! and html! macros
You'll still need to pull in a renderer to render the Dioxus VDOM. Any one of:
- dioxus-web (to run in WASM)
- dioxus-ssr (to run on the server or for static sites)
- dioxus-webview (to run on the desktop)
- dioxus-mobile (to run on iOS/Android)
Make sure dioxus and its renderer share the same major version; the renderers themselves rely on dioxus.
[dependencies]
dioxus = "0.2"
dioxus-web = "0.2"
use dioxus::*;
fn main() {
dioxus_web::start(|ctx| {
rsx!{in ctx, div { "Hello world" }}
})
}
Additionally, you'll want to look at other projects for more batteries
- essential-hooks (use_router, use_storage, use_cache, use_channel)
- Recoil.rs or Reducer.rs for state management
- 3D renderer (ThreeD), charts (Sciviz), game engine (Bevy)
Extra resources:
- The guide is available at:
- The crate docs are at:
- Video tutorials are at:
- Examples are at:
- Full clones are at:
- Community at: www.reddit.com/r/dioxus
Happy building!