docs: update local examples and docs to support new syntaxes
This commit is contained in:
1 parent
e495b09bf1
commit
4de16c4779
118 files changed
+520
-1154
No files matched your search
@@ -9,7 +9,7 @@ fn main() {
|
||||
println!("{}", dom);
|
||||
}
|
||||
|
||||
pub static EXAMPLE: FC<()> = |cx, _| {
|
||||
pub static EXAMPLE: Component<()> = |cx| {
|
||||
let list = (0..10).map(|_f| {
|
||||
rsx! {
|
||||
"{_f}"
|
||||
|
||||
@@ -5,7 +5,7 @@ fn main() {
|
||||
dom.rebuild();
|
||||
}
|
||||
|
||||
const App: FC<()> = |cx, props| {
|
||||
const App: Component<()> = |cx| {
|
||||
let id = cx.scope_id();
|
||||
// cx.submit_task(Box::pin(async move { id }));
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ struct SomeContext {
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
static Example: FC<()> = |cx, props| {
|
||||
static Example: Component<()> = |cx| {
|
||||
todo!()
|
||||
|
||||
// let value = cx.use_context(|c: &SomeContext| c.items.last().unwrap());
|
||||
|
||||
@@ -47,9 +47,9 @@ fn Row<'a>((cx, props): Scope<'a, RowProps>) -> Element<'a> {
|
||||
};
|
||||
cx.render(rsx! {
|
||||
tr {
|
||||
// td { class:"col-md-1", "{props.row_id}" }
|
||||
// td { class:"col-md-1", "{cx.props.row_id}" }
|
||||
// td { class:"col-md-1", onclick: move |_| { /* run onselect */ }
|
||||
// a { class: "lbl", "{props.label}" }
|
||||
// a { class: "lbl", "{cx.props.label}" }
|
||||
// }
|
||||
// td { class: "col-md-1"
|
||||
// a { class: "remove", onclick: {handler}
|
||||
|
||||
@@ -31,9 +31,9 @@ fn html_usage() {
|
||||
// let p = rsx!(div { {f} });
|
||||
}
|
||||
|
||||
static App2: FC<()> = |cx, _| cx.render(rsx!("hello world!"));
|
||||
static App2: Component<()> = |cx, _| cx.render(rsx!("hello world!"));
|
||||
|
||||
static App: FC<()> = |cx, props| {
|
||||
static App: Component<()> = |cx| {
|
||||
let name = cx.use_state(|| 0);
|
||||
|
||||
cx.render(rsx!(div {
|
||||
@@ -71,7 +71,7 @@ struct ChildProps {
|
||||
|
||||
fn Child<'a>((cx, props): Scope<'a, ChildProps>) -> Element<'a> {
|
||||
cx.render(rsx!(div {
|
||||
// {props.children}
|
||||
// {cx.props.children}
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ impl<'a> Children<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
static Bapp: FC<()> = |cx, props| {
|
||||
static Bapp: Component<()> = |cx| {
|
||||
let name = cx.use_state(|| 0);
|
||||
|
||||
cx.render(rsx!(
|
||||
@@ -114,7 +114,7 @@ static Bapp: FC<()> = |cx, props| {
|
||||
))
|
||||
};
|
||||
|
||||
static Match: FC<()> = |cx, props| {
|
||||
static Match: Component<()> = |cx| {
|
||||
//
|
||||
let b: Box<dyn Fn(NodeFactory) -> VNode> = Box::new(|f| todo!());
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ fn t() {
|
||||
// let a = rsx! {
|
||||
// div {
|
||||
// "asd"
|
||||
// "{props.foo}"
|
||||
// "{cx.props.foo}"
|
||||
// }
|
||||
// };
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use dioxus_core::{lazynodes::LazyNodes, prelude::*};
|
||||
|
||||
// #[async_std::main]
|
||||
fn main() {
|
||||
static App: FC<()> =
|
||||
static App: Component<()> =
|
||||
|cx, props| cx.render(Some(LazyNodes::new(move |f| f.text(format_args!("hello")))));
|
||||
|
||||
let mut dom = VirtualDom::new(App);
|
||||
|
||||
Reference in new issue
Block a user