docs: big updates to the reference
This commit is contained in:
1 parent
caf772cf24
commit
583fdfa561
57 files changed
+726
-247
No files matched your search
@@ -1,10 +1,37 @@
|
||||
use dioxus::prelude::*;
|
||||
fn main() {}
|
||||
//! Example: The basics of Dioxus
|
||||
//! ----------------------------
|
||||
//!
|
||||
//! This small example covers some of the basics of Dioxus including
|
||||
//! - Components
|
||||
//! - Props
|
||||
//! - Children
|
||||
//! - the rsx! macro
|
||||
|
||||
static Example: FC<()> = |cx| {
|
||||
use dioxus::prelude::*;
|
||||
|
||||
pub static Example: FC<()> = |cx| {
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
Greeting {
|
||||
name: "Dioxus"
|
||||
div { "Dioxus is a fun, fast, and portable UI framework for Rust" }
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
#[derive(PartialEq, Props)]
|
||||
struct GreetingProps {
|
||||
name: &'static str,
|
||||
}
|
||||
|
||||
static Greeting: FC<GreetingProps> = |cx| {
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
h1 { "Hello, {cx.name}!" }
|
||||
p { "Welcome to the Diouxs framework" }
|
||||
br {}
|
||||
{cx.children()}
|
||||
}
|
||||
})
|
||||
};
|
||||
Reference in new issue
Block a user