docs: update local examples and docs to support new syntaxes

This commit is contained in:
Jonathan Kelley committed 2021-12-15 15:56:53 -05:00
1 parent e495b09bf1
commit 4de16c4779
118 files changed
+520 -1154

No files matched your search

+3 -3
View File
@@ -92,7 +92,7 @@ use dioxus::prelude::*;
fn main() {
dioxus::desktop::launch(App, |c| c);
dioxus::desktop::launch(App);
}
fn App(cx: Context, props: &()) -> Element {
@@ -118,7 +118,7 @@ This initialization code launches a Tokio runtime on a helper thread where your
```rust
fn main() {
dioxus::desktop::launch(App, |c| c);
dioxus::desktop::launch(App);
}
```
@@ -135,7 +135,7 @@ fn App(cx: Context, props: &()) -> Element {
Writing `fn App(cx: Context, props: &()) -> Element {` might become tedious. Rust will also let you write functions as static closures, but these types of Components cannot have props that borrow data.
```rust
static App: FC<()> = |cx, props| cx.render(rsx!(div { "Hello, world!" }));
static App: Component<()> = |cx, props| cx.render(rsx!(div { "Hello, world!" }));
```
### What is this `Context` object?