Merge branch 'master' of https://github.com/DioxusLabs/dioxus into rusty-events

 Conflicts:
	packages/html/src/events.rs
	packages/tui/src/hooks.rs
This commit is contained in:
Reinis Mazeiks committed 2022-06-28 21:09:20 +03:00
commit f3fcec2bdf
87 files changed
+6230 -868

No files matched your search

+1 -1
View File
@@ -71,7 +71,7 @@ Desktop APIs will likely be in flux as we figure out better patterns than our El
[Jump to the getting started guide for Desktop.](/reference/platforms/desktop)
Examples:
- [File explorer](https://github.com/dioxusLabs/file-explorer/)
- [File explorer](https://github.com/DioxusLabs/example-projects/blob/master/file-explorer)
- [WiFi scanner](https://github.com/DioxusLabs/example-projects/blob/master/wifi-scanner)
[![File ExplorerExample](https://raw.githubusercontent.com/DioxusLabs/example-projects/master/file-explorer/image.png)](https://github.com/DioxusLabs/example-projects/tree/master/file-explorer)
+10 -10
View File
@@ -64,7 +64,7 @@ The most common hook you'll use for storing state is `use_state`. `use_state` pr
```rust
fn App(cx: Scope)-> Element {
let (post, set_post) = use_state(&cx, || {
let post = use_state(&cx, || {
PostData {
id: Uuid::new_v4(),
score: 10,
@@ -112,11 +112,11 @@ For example, let's say we provide a button to generate a new post. Whenever the
```rust
fn App(cx: Scope)-> Element {
let (post, set_post) = use_state(&cx, || PostData::new());
let post = use_state(&cx, || PostData::new());
cx.render(rsx!{
button {
onclick: move |_| set_post(PostData::random())
onclick: move |_| post.set(PostData::random())
"Generate a random post"
}
Post { props: &post }
@@ -141,19 +141,19 @@ We can use tasks in our components to build a tiny stopwatch that ticks every se
```rust
fn App(cx: Scope)-> Element {
let (elapsed, set_elapsed) = use_state(&cx, || 0);
use_future(&cx, || {
to_owned![set_elapsed]; // explicitly capture this hook for use in async
let elapsed = use_state(&cx, || 0);
use_future(&cx, (), |()| {
to_owned![elapsed]; // explicitly capture this hook for use in async
async move {
loop {
TimeoutFuture::from_ms(1000).await;
set_elapsed.modify(|i| i + 1)
gloo_timers::future::TimeoutFuture::new(1_000).await;
elapsed.modify(|i| i + 1)
}
}
});
rsx!(cx, div { "Current stopwatch time: {sec_elapsed}" })
rsx!(cx, div { "Current stopwatch time: {elapsed}" })
}
```
+1 -1
View File
@@ -59,7 +59,7 @@ When using Debian/bullseye `libappindicator3-dev` is no longer available but rep
sudo apt install libwebkit2gtk-4.0-dev libgtk-3-dev libayatana-appindicator3-dev
```
If you run into issues, make sure you have all the basics installed, as outlined in the [Tauri docs](https://tauri.studio/en/docs/get-started/setup-linux).
If you run into issues, make sure you have all the basics installed, as outlined in the [Tauri docs](https://tauri.studio/v1/guides/getting-started/prerequisites#setting-up-linux).
### macOS