fixing build warnings in hello world example

Fixing this warning when I try to compile

warning: function `App` should have a snake case name
 --> src/main.rs:7:4
  |
7 | fn App(cx: Scope) -> Element {
  |    ^^^ help: convert the identifier to snake case: `app`
  |
  = note: `#[warn(non_snake_case)]` on by default

Also changing edition from 2018 to 2021
This commit is contained in:
Oliver Forral authored and GitHub committed 2022-02-20 17:27:07 -07:00
1 parent c5a022112b
commit d700850b70
1 file changed
+5 -5
+5 -5
View File
@@ -63,7 +63,7 @@ $ cat Cargo.toml
[package] [package]
name = "hello-dioxus" name = "hello-dioxus"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -92,10 +92,10 @@ use dioxus::prelude::*;
fn main() { fn main() {
dioxus::desktop::launch(App); dioxus::desktop::launch(app);
} }
fn App(cx: Scope) -> Element { fn app(cx: Scope) -> Element {
cx.render(rsx! ( cx.render(rsx! (
div { "Hello, world!" } div { "Hello, world!" }
)) ))
@@ -118,14 +118,14 @@ This initialization code launches a Tokio runtime on a helper thread where your
```rust ```rust
fn main() { fn main() {
dioxus::desktop::launch(App); dioxus::desktop::launch(app);
} }
``` ```
Finally, our app. Every component in Dioxus is a function that takes in `Context` and `Props` and returns an `Element`. Finally, our app. Every component in Dioxus is a function that takes in `Context` and `Props` and returns an `Element`.
```rust ```rust
fn App(cx: Scope) -> Element { fn app(cx: Scope) -> Element {
cx.render(rsx! { cx.render(rsx! {
div { "Hello, world!" } div { "Hello, world!" }
}) })