fix: readme and examples syntax

This commit is contained in:
Jonathan Kelley committed 2021-12-28 23:48:25 -05:00
1 parent f24aae8787
commit 3dc0e59876
102 files changed
+213 -1222

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ struct DogApi {
message: String,
}
static APP: Component<()> = |(cx, _props)| {
static APP: Component = |(cx, _props)| {
let state = use_state(&cx, || 0);
const ENDPOINT: &str = "https://dog.ceo/api/breeds/image/random/";
+4 -4
View File
@@ -14,7 +14,7 @@ fn main() {
dioxus_web::launch(APP)
}
static APP: Component<()> = |cx| {
static APP: Component = |cx| {
let mut count = use_state(&cx, || 3);
let content = use_state(&cx, || String::from("h1"));
let text_content = use_state(&cx, || String::from("Hello, world!"));
@@ -68,13 +68,13 @@ static APP: Component<()> = |cx| {
})
};
fn render_bullets(cx: Context) -> Element {
fn render_bullets(cx: Scope) -> Element {
rsx!(cx, div {
"bite me"
})
}
fn render_list(cx: Context, count: usize) -> Element {
fn render_list(cx: Scope, count: usize) -> Element {
let items = (0..count).map(|f| {
rsx! {
li { "a - {f}" }
@@ -86,4 +86,4 @@ fn render_list(cx: Context, count: usize) -> Element {
rsx!(cx, ul { {items} })
}
static CHILD: Component<()> = |cx, _| rsx!(cx, div {"hello child"});
static CHILD: Component = |cx, _| rsx!(cx, div {"hello child"});
+1 -1
View File
@@ -24,7 +24,7 @@ fn main() {
dioxus_web::launch(App)
}
static App: Component<()> = |cx| {
static App: Component = |cx| {
let mut state = use_state(&cx, || 0);
cx.render(rsx! {
div {
+2 -2
View File
@@ -23,7 +23,7 @@ fn main() {
// dioxus::web::launch(App);
}
static App: Component<()> = |cx| {
static App: Component = |cx| {
dbg!("rednering parent");
cx.render(rsx! {
div {
@@ -40,7 +40,7 @@ static App: Component<()> = |cx| {
})
};
static But: Component<()> = |cx| {
static But: Component = |cx| {
let mut count = use_state(&cx, || 0);
// let d = Dropper { name: "asd" };
+1 -1
View File
@@ -28,7 +28,7 @@ pub struct Client {
pub description: String,
}
static App: Component<()> = |cx| {
static App: Component = |cx| {
let scene = use_state(&cx, || Scene::ClientsList);
let clients = use_ref(&cx, || vec![] as Vec<Client>);
+6 -6
View File
@@ -24,7 +24,7 @@ fn main() {
dioxus_web::launch(App)
}
pub static App: Component<()> = |cx| {
pub static App: Component = |cx| {
cx.render(rsx!(
div { class: "overflow-hidden"
link { href:"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel:"stylesheet" }
@@ -39,7 +39,7 @@ pub static App: Component<()> = |cx| {
))
};
pub static Header: Component<()> = |cx| {
pub static Header: Component = |cx| {
cx.render(rsx! {
div {
header { class: "text-gray-400 bg-gray-900 body-font"
@@ -65,7 +65,7 @@ pub static Header: Component<()> = |cx| {
})
};
pub static Hero: Component<()> = |cx| {
pub static Hero: Component = |cx| {
//
cx.render(rsx! {
section{ class: "text-gray-400 bg-gray-900 body-font"
@@ -103,7 +103,7 @@ pub static Hero: Component<()> = |cx| {
}
})
};
pub static Entry: Component<()> = |cx| {
pub static Entry: Component = |cx| {
//
cx.render(rsx! {
section{ class: "text-gray-400 bg-gray-900 body-font"
@@ -116,7 +116,7 @@ pub static Entry: Component<()> = |cx| {
})
};
pub static StacksIcon: Component<()> = |cx| {
pub static StacksIcon: Component = |cx| {
cx.render(rsx!(
svg {
// xmlns: "http://www.w3.org/2000/svg"
@@ -131,7 +131,7 @@ pub static StacksIcon: Component<()> = |cx| {
}
))
};
pub static RightArrowIcon: Component<()> = |cx| {
pub static RightArrowIcon: Component = |cx| {
cx.render(rsx!(
svg {
fill: "none"