Fix Outdated README.md (#2147)
* fix: outdated readme * Fix missing readme --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
dadbab5d72
commit
3cbe6ff96e
26 files changed
+92
-356
No files matched your search
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5) |
|
||||
[API Docs](https://docs.rs/dioxus-autofmt/latest/dioxus_autofmt) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5) |
|
||||
[API Docs](https://docs.rs/dioxus-check) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
## Overview
|
||||
|
||||
`dioxus-check` analyzes Dioxus source code and reports errors and warnings. Primarily, it enforces the [Rules of Hooks](https://dioxuslabs.com/learn/0.4/reference/hooks#rules-of-hooks).
|
||||
`dioxus-check` analyzes Dioxus source code and reports errors and warnings. Primarily, it enforces the [Rules of Hooks](https://dioxuslabs.com/learn/0.5/reference/hooks#rules-of-hooks).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div style="text-align: center">
|
||||
<div>
|
||||
<h1>📦✨ Dioxus CLI Configuration</h1>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div style="text-align: center">
|
||||
<div>
|
||||
<h1>📦✨ Dioxus CLI</h1>
|
||||
<p><strong>Tooling to supercharge Dioxus projects</strong></p>
|
||||
</div>
|
||||
@@ -28,9 +28,9 @@ This will download the CLI from the master branch,
|
||||
and install it in Cargo's global binary directory (`~/.cargo/bin/` by default).
|
||||
|
||||
### Install from local folder
|
||||
|
||||
Note: The CLI will fail to build projects in debug profile. This is currently under investigation.
|
||||
```shell
|
||||
cargo install --path . --debug
|
||||
cargo install --path . --release
|
||||
```
|
||||
|
||||
## Get started
|
||||
@@ -68,4 +68,4 @@ title = "Hello"
|
||||
[web.resource.dev]
|
||||
```
|
||||
|
||||
The full anatomy of `Dioxus.toml` is shown on the [Dioxus website](https://dioxuslabs.com/learn/0.4/CLI/configure).
|
||||
The full anatomy of `Dioxus.toml` is shown on the [Dioxus website](https://dioxuslabs.com/learn/0.5/CLI/configure).
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5) |
|
||||
[API Docs](https://docs.rs/dioxus-config-macro/latest/dioxus_core_macro) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5) |
|
||||
[API Docs](https://docs.rs/dioxus-core-macro/latest/dioxus_core_macro) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ fn main() {
|
||||
```
|
||||
|
||||
## Contributing
|
||||
- Check out the website [section on contributing](https://dioxuslabs.com/learn/0.4/contributing).
|
||||
- Check out the website [section on contributing](https://dioxuslabs.com/learn/0.5/contributing).
|
||||
- Report issues on our [issue tracker](https://github.com/dioxuslabs/dioxus/issues).
|
||||
- [Join](https://discord.gg/XgGxMSkvUM) the discord and ask questions!
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5) |
|
||||
[API Docs](https://docs.rs/dioxus-desktop/latest/dioxus_desktop) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
This requires that webview is installed on the target system. WebView is installed by default on macOS and iOS devices, but might not come preinstalled on Windows or Linux devices. To fix these issues, follow the [instructions in the guide](guide-url).
|
||||
|
||||
[guide-url]: https://dioxuslabs.com/learn/0.4/getting_started/desktop
|
||||
[guide-url]: https://dioxuslabs.com/learn/0.5/getting_started/desktop
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div style="text-align: center">
|
||||
<div>
|
||||
<h1>🌗🚀 Dioxus</h1>
|
||||
<p>
|
||||
<strong>A concurrent, functional, virtual DOM for Rust</strong>
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
This overview provides a brief introduction to Dioxus. For a more in-depth guide, make sure to check out:
|
||||
|
||||
- [Getting Started](https://dioxuslabs.com/learn/0.4/getting_started)
|
||||
- [Book (0.4)](https://dioxuslabs.com/learn/0.4/)
|
||||
- [Getting Started](https://dioxuslabs.com/learn/0.5/getting_started)
|
||||
- [Book (0.5)](https://dioxuslabs.com/learn/0.5)
|
||||
- [Examples](https://github.com/DioxusLabs/example-projects)
|
||||
|
||||
# Overview and Goals
|
||||
@@ -34,23 +34,22 @@ Remember: Dioxus is a library for declaring interactive user interfaces—it is
|
||||
|
||||
## Brief Overview
|
||||
|
||||
All Dioxus apps are built by composing functions that take in a `Scope` which is generic over some `Properties` and return an `Element`.
|
||||
A `Scope` holds relevant state data for the currently rendered component.
|
||||
All Dioxus apps are built by composing functions that return an `Element`.
|
||||
|
||||
To launch an app, we use the `launch` method for the specific renderer we want to use. In the launch function, we pass the app's `Component`.
|
||||
To launch an app, we use the `launch` method and use features in ``Cargo.toml`` to specify which renderer we want to use. In the launch function, we pass the app's root `Component`.
|
||||
|
||||
```rust, ignore
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus_desktop::launch(App);
|
||||
launch(App);
|
||||
}
|
||||
|
||||
// The #[component] attribute streamlines component creation.
|
||||
// It's not required, but highly recommended. For example, UpperCamelCase components will not generate a warning.
|
||||
#[component]
|
||||
fn App() -> Element {
|
||||
rsx!("hello world!"))
|
||||
rsx!("hello world!")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -71,7 +70,7 @@ let value = "123";
|
||||
rsx!(
|
||||
div {
|
||||
class: "my-class {value}", // <--- attribute
|
||||
onclick: move |_| log::info!("clicked!"), // <--- listener
|
||||
onclick: move |_| info!("clicked!"), // <--- listener
|
||||
h1 { "hello world" }, // <--- child
|
||||
}
|
||||
)
|
||||
@@ -89,21 +88,12 @@ rsx!(
|
||||
)
|
||||
```
|
||||
|
||||
Used within components, the `rsx!` macro must be rendered into an `Element` with
|
||||
the `render` function on Scope.
|
||||
|
||||
If we want to omit the boilerplate of `cx.render`, we can simply pass in
|
||||
`cx` as the first argument of rsx. This is sometimes useful when we need to
|
||||
render nodes in match statements.
|
||||
The `rsx!` macro is what generates the `Element` that our components return.
|
||||
|
||||
```rust, ignore
|
||||
#[component[
|
||||
#[component]
|
||||
fn Example() -> Element {
|
||||
|
||||
// both of these are equivalent
|
||||
rsx!("hello world"))
|
||||
|
||||
rsx!("hello world!")
|
||||
rsx!("hello world")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -127,7 +117,7 @@ fn App() -> Element {
|
||||
))
|
||||
|
||||
}
|
||||
))
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -147,7 +137,7 @@ fn App() -> Element {
|
||||
title: "My App",
|
||||
color: "red",
|
||||
}
|
||||
))
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -163,13 +153,13 @@ struct HeaderProps {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Header(cx: Scope<HeaderProps>) -> Element {
|
||||
fn Header(props: HeaderProps) -> Element {
|
||||
rsx!(
|
||||
div {
|
||||
background_color: "{cx.props.color}"
|
||||
h1 { "{cx.props.title}" }
|
||||
background_color: "{props.color}"
|
||||
h1 { "{props.title}" }
|
||||
}
|
||||
))
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -184,7 +174,7 @@ fn Header(title: String, color: String) -> Element {
|
||||
background_color: "{color}"
|
||||
h1 { "{title}" }
|
||||
}
|
||||
))
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -201,13 +191,13 @@ struct HeaderProps<'a> {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Header(props: HeaderProps -> Element {
|
||||
fn Header<'a>(props: HeaderProps<'a>) -> Element {
|
||||
rsx!(
|
||||
div {
|
||||
background_color: "{cx.props.color}"
|
||||
h1 { "{cx.props.title}" }
|
||||
background_color: "{props.color}"
|
||||
h1 { "{props.title}" }
|
||||
}
|
||||
))
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -235,7 +225,7 @@ but you can turn it off if you wish.
|
||||
## Hooks
|
||||
|
||||
While components are reusable forms of UI elements, hooks are reusable forms
|
||||
of logic. Hooks provide us a way of retrieving state from the `Scope` and using
|
||||
of logic. Hooks provide us a way of retrieving state from Dioxus' internal `Scope` and using
|
||||
it to render UI elements.
|
||||
|
||||
By convention, all hooks are functions that should start with `use_`. We can
|
||||
@@ -251,7 +241,7 @@ fn App() -> Element {
|
||||
```
|
||||
|
||||
Hooks are sensitive to how they are used. To use hooks, you must abide by the
|
||||
["rules of hooks" (borrowed from React)](https://reactjs.org/docs/hooks-rules.html):
|
||||
["rules of hooks"](https://dioxuslabs.com/learn/0.5/reference/hooks#rules-of-hooks):
|
||||
|
||||
- Functions with "use\_" should not be called in callbacks
|
||||
- Functions with "use\_" should not be called out of order
|
||||
@@ -270,11 +260,11 @@ fn use_username(d: Uuid) -> bool {
|
||||
}
|
||||
```
|
||||
|
||||
To create entirely new foundational hooks, we can use the `use_hook` method on `ScopeState`.
|
||||
To create entirely new foundational hooks, we can use the `use_hook` method.
|
||||
|
||||
```rust, ignore
|
||||
fn use_mut_string() -> &mut String {
|
||||
cx.use_hook(|_| "Hello".to_string())
|
||||
use_hook(|_| "Hello".to_string())
|
||||
}
|
||||
```
|
||||
|
||||
@@ -288,7 +278,7 @@ Using components, templates, and hooks, we can build a simple app.
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus_desktop::launch(App);
|
||||
launch(App);
|
||||
}
|
||||
|
||||
#[component]
|
||||
@@ -299,7 +289,7 @@ fn App() -> Element {
|
||||
div { "Count: {count}" }
|
||||
button { onclick: move |_| count.set(count + 1), "Increment" }
|
||||
button { onclick: move |_| count.set(count - 1), "Decrement" }
|
||||
))
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
+20
-29
@@ -1,4 +1,4 @@
|
||||
<div style="text-align: center">
|
||||
<div>
|
||||
<h1>🌗🚀 Dioxus</h1>
|
||||
<p>
|
||||
<strong>A concurrent, functional, virtual DOM for Rust</strong>
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
This overview provides a brief introduction to Dioxus. For a more in-depth guide, make sure to check out:
|
||||
|
||||
- [Getting Started](https://dioxuslabs.com/learn/0.4/getting_started)
|
||||
- [Book (0.4)](https://dioxuslabs.com/learn/0.4/)
|
||||
- [Getting Started](https://dioxuslabs.com/learn/0.5/getting_started)
|
||||
- [Book (0.5)](https://dioxuslabs.com/learn/0.5)
|
||||
- [Examples](https://github.com/DioxusLabs/example-projects)
|
||||
|
||||
# Overview and Goals
|
||||
@@ -34,16 +34,15 @@ Remember: Dioxus is a library for declaring interactive user interfaces—it is
|
||||
|
||||
## Brief Overview
|
||||
|
||||
All Dioxus apps are built by composing functions that take in a `Scope` which is generic over some `Properties` and return an `Element`.
|
||||
A `Scope` holds relevant state data for the currently rendered component.
|
||||
All Dioxus apps are built by composing functions that return an `Element`.
|
||||
|
||||
To launch an app, we use the `launch` method for the specific renderer we want to use. In the launch function, we pass the app's `Component`.
|
||||
To launch an app, we use the `launch` method and use features in ``Cargo.toml`` to specify which renderer we want to use. In the launch function, we pass the app's root `Component`.
|
||||
|
||||
```rust, ignore
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus_desktop::launch(App);
|
||||
launch(App);
|
||||
}
|
||||
|
||||
// The #[component] attribute streamlines component creation.
|
||||
@@ -71,7 +70,7 @@ let value = "123";
|
||||
rsx!(
|
||||
div {
|
||||
class: "my-class {value}", // <--- attribute
|
||||
onclick: move |_| log::info!("clicked!"), // <--- listener
|
||||
onclick: move |_| info!("clicked!"), // <--- listener
|
||||
h1 { "hello world" }, // <--- child
|
||||
}
|
||||
)
|
||||
@@ -89,20 +88,12 @@ rsx!(
|
||||
)
|
||||
```
|
||||
|
||||
Used within components, the `rsx!` macro must be rendered into an `Element` with
|
||||
the `render` function on Scope.
|
||||
|
||||
If we want to omit the boilerplate of `cx.render`, we can simply pass in
|
||||
`cx` as the first argument of rsx. This is sometimes useful when we need to
|
||||
render nodes in match statements.
|
||||
The `rsx!` macro is what generates the `Element` that our components return.
|
||||
|
||||
```rust, ignore
|
||||
#[component]
|
||||
fn Example() -> Element {
|
||||
// both of these are equivalent
|
||||
rsx!("hello world");
|
||||
|
||||
rsx!("hello world!");
|
||||
rsx!("hello world")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -162,11 +153,11 @@ struct HeaderProps {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Header(cx: Scope<HeaderProps>) -> Element {
|
||||
fn Header(props: HeaderProps) -> Element {
|
||||
rsx!(
|
||||
div {
|
||||
background_color: "{cx.props.color}"
|
||||
h1 { "{cx.props.title}" }
|
||||
background_color: "{props.color}"
|
||||
h1 { "{props.title}" }
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -200,11 +191,11 @@ struct HeaderProps<'a> {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Header(props: HeaderProps) -> Element {
|
||||
fn Header<'a>(props: HeaderProps<'a>) -> Element {
|
||||
rsx!(
|
||||
div {
|
||||
background_color: "{cx.props.color}"
|
||||
h1 { "{cx.props.title}" }
|
||||
background_color: "{props.color}"
|
||||
h1 { "{props.title}" }
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -234,7 +225,7 @@ but you can turn it off if you wish.
|
||||
## Hooks
|
||||
|
||||
While components are reusable forms of UI elements, hooks are reusable forms
|
||||
of logic. Hooks provide us a way of retrieving state from the `Scope` and using
|
||||
of logic. Hooks provide us a way of retrieving state from Dioxus' internal `Scope` and using
|
||||
it to render UI elements.
|
||||
|
||||
By convention, all hooks are functions that should start with `use_`. We can
|
||||
@@ -250,7 +241,7 @@ fn App() -> Element {
|
||||
```
|
||||
|
||||
Hooks are sensitive to how they are used. To use hooks, you must abide by the
|
||||
["rules of hooks" (borrowed from React)](https://reactjs.org/docs/hooks-rules.html):
|
||||
["rules of hooks"](https://dioxuslabs.com/learn/0.5/reference/hooks#rules-of-hooks):
|
||||
|
||||
- Functions with "use\_" should not be called in callbacks
|
||||
- Functions with "use\_" should not be called out of order
|
||||
@@ -269,11 +260,11 @@ fn use_username(d: Uuid) -> bool {
|
||||
}
|
||||
```
|
||||
|
||||
To create entirely new foundational hooks, we can use the `use_hook` method on `ScopeState`.
|
||||
To create entirely new foundational hooks, we can use the `use_hook` method.
|
||||
|
||||
```rust, ignore
|
||||
fn use_mut_string() -> &mut String {
|
||||
cx.use_hook(|_| "Hello".to_string())
|
||||
use_hook(|_| "Hello".to_string())
|
||||
}
|
||||
```
|
||||
|
||||
@@ -287,7 +278,7 @@ Using components, templates, and hooks, we can build a simple app.
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus_desktop::launch(App);
|
||||
launch(App);
|
||||
}
|
||||
|
||||
#[component]
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5/) |
|
||||
[API Docs](https://docs.rs/dioxus-fullstack/latest/dioxus_sever) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
@@ -23,41 +23,25 @@ Fullstack utilities for the [`Dioxus`](https://dioxuslabs.com) framework.
|
||||
|
||||
# Features
|
||||
|
||||
- Intigrations with the [Axum](https::/docs.rs/dioxus-fullstack/latest/dixous_server/axum_adapter/index.html), [Salvo](https::/docs.rs/dioxus-fullstack/latest/dixous_server/salvo_adapter/index.html), and [Warp](https::/docs.rs/dioxus-fullstack/latest/dixous_server/warp_adapter/index.html) server frameworks with utilities for serving and rendering Dioxus applications.
|
||||
- Integrates with the [Axum](https::/docs.rs/dioxus-fullstack/latest/dixous_server/axum_adapter/index.html) server framework with utilities for serving and rendering Dioxus applications.
|
||||
- [Server functions](https::/docs.rs/dioxus-fullstack/latest/dixous_server/prelude/attr.server.html) allow you to call code on the server from the client as if it were a normal function.
|
||||
- Instant RSX Hot reloading with [`dioxus-hot-reload`](https://crates.io/crates/dioxus-hot-reload).
|
||||
- Passing root props from the server to the client.
|
||||
|
||||
# Example
|
||||
|
||||
Full stack Dioxus in under 50 lines of code
|
||||
Full stack Dioxus in under 30 lines of code
|
||||
|
||||
```rust
|
||||
#![allow(non_snake_case)]
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_fullstack::prelude::*;
|
||||
|
||||
// On the web, run our client code
|
||||
#[cfg(feature = "web")]
|
||||
fn main() {
|
||||
dioxus_web::launch_with_props(
|
||||
app,
|
||||
get_root_props_from_document().unwrap_or_default(),
|
||||
dioxus_web::Config::new().hydrate(true),
|
||||
);
|
||||
launch(App);
|
||||
}
|
||||
|
||||
// On the server, run a simple warp server
|
||||
#[cfg(feature = "server")]
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
// Automatically handles server side rendering, hot reloading intigration, and hosting server functions
|
||||
warp::serve(serve_dioxus_application("", ServerConfig::new(app, ())))
|
||||
.run(([127, 0, 0, 1], 8080))
|
||||
.await;
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
#[component]
|
||||
fn App() -> Element {
|
||||
let meaning = use_signal(|| None);
|
||||
|
||||
rsx! {
|
||||
@@ -81,7 +65,7 @@ async fn get_meaning(of: String) -> Result<Option<u32>, ServerFnError> {
|
||||
|
||||
## Getting Started
|
||||
|
||||
To get started with full stack Dioxus, check out our [getting started guide](https://dioxuslabs.com/docs/nightly/guide/en/getting_started/ssr.html), or the [full stack examples](https://github.com/DioxusLabs/dioxus/tree/master/packages/fullstack/examples).
|
||||
To get started with full stack Dioxus, check out our [getting started guide](https://dioxuslabs.com/learn/0.5/getting_started/fullstack), or the [full stack examples](https://github.com/DioxusLabs/dioxus/tree/master/packages/fullstack/examples).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -15,27 +15,26 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5/) |
|
||||
[API Docs](https://docs.rs/dioxus-hooks/latest/dioxus_hooks) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
## Overview
|
||||
|
||||
`dioxus-hooks` includes some basic useful hooks for dioxus:
|
||||
`dioxus-hooks` includes some basic useful hooks for dioxus such as:
|
||||
|
||||
- use_state
|
||||
- use_ref
|
||||
- use_future
|
||||
- use_signal
|
||||
- use_effect
|
||||
- use_resource
|
||||
- use_memo
|
||||
- use_coroutine
|
||||
- use_callback
|
||||
|
||||
Unlike React, none of these hooks are foundational since they all build off the primitive `cx.use_hook`.
|
||||
|
||||
This crate also provides a few helpful macros to get around some Rust lifetime management issues in async.
|
||||
Unlike React, none of these hooks are foundational since they all build off the primitive `use_hook`.
|
||||
|
||||
This crate also provides a helpful macro to get around some Rust lifetime management issues in async:
|
||||
|
||||
- `to_owned![]`
|
||||
- `use_future()`
|
||||
- `use_callback!()`
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5/) |
|
||||
[API Docs](https://docs.rs/dioxus-hot-reload/latest/dioxus_hot_reload) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5/) |
|
||||
[API Docs](https://docs.rs/dioxus-html/latest/dioxus_html) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5/) |
|
||||
[API Docs](https://docs.rs/dioxus-interpreter-js/latest/dioxus_interpreter_js) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5/) |
|
||||
[API Docs](https://docs.rs/dioxus-liveview/latest/dioxus_liveview) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
@@ -29,70 +29,7 @@ Dioxus Mobile supports both iOS and Android. However, Android support is still q
|
||||
|
||||
Getting set up with mobile can but quite challenging. The tooling here isn't great (yet) and might take some hacking around to get things working. macOS M1 is broadly unexplored and might not work for you.
|
||||
|
||||
We're going to be using `cargo-mobile` to build for mobile. First, install it:
|
||||
|
||||
```shell
|
||||
$ cargo install --git https://github.com/BrainiumLLC/cargo-mobile
|
||||
```
|
||||
|
||||
And then initialize your app for the right platform. Use the `winit` template for now. Right now, there's no "Dioxus" template in cargo-mobile.
|
||||
|
||||
```shell
|
||||
$ cargo mobile init
|
||||
```
|
||||
|
||||
We're going to completely clear out the `dependencies` it generates for us, swapping out `winit` with `dioxus-mobile`.
|
||||
|
||||
```toml
|
||||
|
||||
[package]
|
||||
name = "dioxus-ios-demo"
|
||||
version = "0.1.0"
|
||||
authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
|
||||
# leave the `lib` declaration
|
||||
[lib]
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
|
||||
# leave the binary it generates for us
|
||||
[[bin]]
|
||||
name = "dioxus-ios-demo-desktop"
|
||||
path = "gen/bin/desktop.rs"
|
||||
|
||||
# clear all the dependencies
|
||||
[dependencies]
|
||||
mobile-entry-point = "0.1.0"
|
||||
dioxus = { version = "*", features = ["mobile"] }
|
||||
simple_logger = "*"
|
||||
```
|
||||
|
||||
Edit your `lib.rs`:
|
||||
|
||||
```rust
|
||||
// main.rs
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus_mobile::launch(app);
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
rsx!{
|
||||
div {
|
||||
"hello world!"
|
||||
}
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
To configure the web view, menubar, and other important desktop-specific features, checkout out some of the launch configurations in the [API reference](https://docs.rs/dioxus-mobile/).
|
||||
|
||||
## Future Steps
|
||||
|
||||
Make sure to read the [Dioxus Guide](https://dioxuslabs.com/learn/0.4/) if you already haven't!
|
||||
You can read [our guide](https://dioxuslabs.com/learn/0.5/getting_started/mobile) on mobile development with Dioxus to get started.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
Whitespace-only changes.
@@ -1,4 +1,3 @@
|
||||
#![doc = include_str!("../README.md")]
|
||||
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
|
||||
#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/router/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5/router/) |
|
||||
[API Docs](https://docs.rs/dioxus-router/latest/dioxus_router) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5/) |
|
||||
[API Docs](https://docs.rs/rsx-rosetta/latest/rsx-rosetta) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5/) |
|
||||
[API Docs](https://docs.rs/dioxus-rsx/latest/dioxus_rsx) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
This crate is a part of the broader Dioxus ecosystem. For more resources about Dioxus, check out:
|
||||
|
||||
- [Getting Started](https://dioxuslabs.com/learn/0.4/getting_started)
|
||||
- [Book](https://dioxuslabs.com/learn/0.4/)
|
||||
- [Getting Started](https://dioxuslabs.com/learn/0.5/getting_started)
|
||||
- [Book](https://dioxuslabs.com/learn/0.5/)
|
||||
- [Examples](https://github.com/DioxusLabs/example-projects)
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.5/) |
|
||||
[API Docs](https://docs.rs/dioxus-web/latest/dioxus_web) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
|
||||
Reference in new issue
Block a user