Skip to content

Commit 3dc0e59

Browse files
committed
fix: readme and examples syntax
1 parent f24aae8 commit 3dc0e59

File tree

102 files changed

+213
-1222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+213
-1222
lines changed

README.md

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,24 @@
2323
</a>
2424
<!-- CI -->
2525
<a href="https://github.com/jkelleyrtp/dioxus/actions">
26-
<img src="https://github.com/jkelleyrtp/dioxus/workflows/CI/badge.svg"
26+
<img src="https://github.com/dioxuslabs/dioxus/actions/workflows/main.yml/badge.svg"
2727
alt="CI status" />
2828
</a>
2929
</div>
3030

3131
<div align="center">
3232
<h3>
33-
<a href="https://docs.rs/dioxus">
34-
API Docs
35-
</a>
33+
<a href="https://dioxuslabs.com/guide"> Guide </a>
3634
<span> | </span>
37-
<a href="https://docs.rs/dioxus">
38-
Website
39-
</a>
35+
<a href="https://dioxuslabs.com"> Website </a>
4036
<span> | </span>
41-
<a href="https://docs.rs/dioxus">
42-
Examples
43-
</a>
37+
<a href="https://github.com/DioxusLabs/awesome-dioxus"> Examples </a>
4438
</h3>
4539
</div>
4640

4741
<br/>
4842

49-
Dioxus is a portable, performant, and ergonomic framework for building cross-platform user experiences in Rust.
43+
Dioxus is a portable, performant, and ergonomic framework for building cross-platform user interfaces in Rust.
5044

5145
```rust
5246
fn app(cx: Scope) -> Element {
@@ -67,21 +61,21 @@ If you know React, then you already know Dioxus.
6761
### Unique features:
6862
- Desktop apps running natively (no Electron!) in less than 10 lines of code.
6963
- Incredibly ergonomic and powerful state management.
70-
- Incredible inline documentation - hover and guides for all HTML elements, listeners, and events.
64+
- Comprehensive inline documentation - hover and guides for all HTML elements, listeners, and events.
7165
- Extremely memory efficient - 0 global allocations for steady-state components.
72-
- Multithreaded asynchronous coroutine scheduler for first-class async support.
73-
- And more! Read the full release post here.
66+
- Multi-channel asynchronous scheduler for first-class async support.
67+
- And more! Read the [full release post here](https://dioxuslabs.com/).
7468

7569
## Get Started with...
7670

7771
<table style="width:100%" align="center">
7872
<tr >
79-
<th><a href="https://dioxuslabs.com/book/">Web</a></th>
80-
<th><a href="https://dioxuslabs.com/book/">Desktop</a></th>
81-
<th><a href="https://dioxuslabs.com/book/">Mobile</a></th>
82-
<th><a href="https://dioxuslabs.com/book/">State</a></th>
83-
<th><a href="https://dioxuslabs.com/book/">Docs</a></th>
84-
<th><a href="https://dioxuslabs.com/book/">Tools</a></th>
73+
<th><a href="https://dioxuslabs.com/guide/">Web</a></th>
74+
<th><a href="https://dioxuslabs.com/guide/">Desktop</a></th>
75+
<th><a href="https://dioxuslabs.com/guide/">Mobile</a></th>
76+
<th><a href="https://dioxuslabs.com/guide/">State</a></th>
77+
<th><a href="https://dioxuslabs.com/guide/">Docs</a></th>
78+
<th><a href="https://dioxuslabs.com/guide/">Tools</a></th>
8579
<tr>
8680
</table>
8781

@@ -182,7 +176,7 @@ Dioxus is heavily inspired by React, but we want your transition to feel like an
182176

183177
This project is licensed under the [MIT license].
184178

185-
[MIT license]: https://github.com/tokio-rs/tokio/blob/master/LICENSE
179+
[MIT license]: https://github.com/dioxuslabs/dioxus/blob/master/LICENSE
186180

187181
### Contribution
188182

docs/guide/src/concepts/06-subscription-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Yew subscriptions are used to schedule update for components into the future. The `Context` object can create subscriptions:
44

55
```rust
6-
fn Component(cx: Component<()>) -> DomTree {
6+
fn Component(cx: Component) -> DomTree {
77
let update = cx.schedule();
88

99
// Now, when the subscription is called, the component will be re-evaluated

docs/guide/src/concepts/11-arena-memo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ fn test() -> DomTree {
2121
}
2222
}
2323

24-
static TestComponent: Component<()> = |cx| html!{<div>"Hello world"</div>};
24+
static TestComponent: Component = |cx| html!{<div>"Hello world"</div>};
2525

26-
static TestComponent: Component<()> = |cx|{
26+
static TestComponent: Component = |cx|{
2727
let g = "BLAH";
2828
html! {
2929
<div> "Hello world" </div>

docs/guide/src/concepts/12-signals.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Sometimes you want a signal to propagate across your app, either through far-awa
9696

9797
```rust
9898
const TITLE: Atom<String> = || "".to_string();
99-
const Provider: Component<()> = |cx|{
99+
const Provider: Component = |cx|{
100100
let title = use_signal(&cx, &TITLE);
101101
rsx!(cx, input { value: title })
102102
};
@@ -105,7 +105,7 @@ const Provider: Component<()> = |cx|{
105105
If we use the `TITLE` atom in another component, we can cause updates to flow between components without calling render or diffing either component trees:
106106

107107
```rust
108-
const Receiver: Component<()> = |cx|{
108+
const Receiver: Component = |cx|{
109109
let title = use_signal(&cx, &TITLE);
110110
log::info!("This will only be called once!");
111111
rsx!(cx,
@@ -132,7 +132,7 @@ Dioxus automatically understands how to use your signals when mixed with iterato
132132

133133
```rust
134134
const DICT: AtomFamily<String, String> = |_| {};
135-
const List: Component<()> = |cx|{
135+
const List: Component = |cx|{
136136
let dict = use_signal(&cx, &DICT);
137137
cx.render(rsx!(
138138
ul {

docs/guide/src/concepts/conditional_rendering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn App(cx: Scope)-> Element {
8383

8484
This syntax even enables us to write a one-line component:
8585
```rust
86-
static App: Component<()> = |cx| rsx!(cx, "hello world!");
86+
static App: Component = |cx| rsx!(cx, "hello world!");
8787
```
8888

8989
Alternatively, for match statements, we can just return the builder itself and pass it into a final, single call to `cx.render`:

docs/guide/src/concepts/errorhandling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Astute observers might have noticed that `Element` is actually a type alias for `Option<VNode>`. You don't need to know what a `VNode` is, but it's important to recognize that we could actually return nothing at all:
55

66
```rust
7-
fn App((cx, props): Component<()>) -> Element {
7+
fn App((cx, props): Component) -> Element {
88
None
99
}
1010
```

docs/guide/src/concepts/exporting_components.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn main() {
2525
dioxus::desktop::launch(App);
2626
}
2727

28-
fn App((cx, props): Component<()>) -> Element {}
28+
fn App((cx, props): Component) -> Element {}
2929

3030
#[derive(PartialEq, Props)]
3131
struct PostProps{}
@@ -92,7 +92,7 @@ fn main() {
9292

9393
mod post;
9494

95-
fn App((cx, props): Component<()>) -> Element {
95+
fn App((cx, props): Component) -> Element {
9696
cx.render(rsx!{
9797
post::Post {
9898
id: Uuid::new_v4(),
@@ -191,7 +191,7 @@ fn main() {
191191

192192
mod post;
193193

194-
fn App((cx, props): Component<()>) -> Element {
194+
fn App((cx, props): Component) -> Element {
195195
cx.render(rsx!{
196196
post::Post {
197197
id: Uuid::new_v4(),

docs/guide/src/hello_world.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fn App(cx: Scope) -> Element {
135135
Writing `fn App(cx: Scope) -> 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.
136136

137137
```rust
138-
static App: Component<()> = |cx| cx.render(rsx!(div { "Hello, world!" }));
138+
static App: Component = |cx| cx.render(rsx!(div { "Hello, world!" }));
139139
```
140140

141141
### What is this `Context` object?

examples/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ Here's what a few common tasks look like in Dioxus:
6464

6565
Nested components with children and internal state:
6666
```rust
67-
fn App(cx: Context, props: &()) -> Element {
67+
fn App(cx: Scope<()>) -> Element {
6868
cx.render(rsx!( Toggle { "Toggle me" } ))
6969
}
7070

7171
#[derive(PartialEq, Props)]
7272
struct ToggleProps { children: Element }
7373

74-
fn Toggle(cx: Context, props: &ToggleProps) -> Element {
74+
fn Toggle(cx: Scope<ToggleProps>) -> Element {
7575
let mut toggled = use_state(&cx, || false);
7676
cx.render(rsx!{
7777
div {
78-
{&props.children}
78+
{&cx.props.children}
7979
button { onclick: move |_| toggled.set(true),
8080
{toggled.and_then(|| "On").or_else(|| "Off")}
8181
}
@@ -86,7 +86,7 @@ fn Toggle(cx: Context, props: &ToggleProps) -> Element {
8686

8787
Controlled inputs:
8888
```rust
89-
fn App(cx: Context, props: &()) -> Element {
89+
fn App(cx: Scope<()>) -> Element {
9090
let value = use_state(&cx, String::new);
9191
cx.render(rsx!(
9292
input {
@@ -100,7 +100,7 @@ fn App(cx: Context, props: &()) -> Element {
100100

101101
Lists and Conditional rendering:
102102
```rust
103-
fn App(cx: Context, props: &()) -> Element {
103+
fn App(cx: Scope<()>) -> Element {
104104
let list = (0..10).map(|i| {
105105
rsx!(li { key: "{i}", "Value: {i}" })
106106
});
@@ -123,20 +123,20 @@ fn App(cx: Context, props: &()) -> Element {
123123

124124
Tiny components:
125125
```rust
126-
static App: Component<()> = |cx, _| rsx!(cx, div {"hello world!"});
126+
static App: Component = |cx, _| rsx!(cx, div {"hello world!"});
127127
```
128128

129129
Borrowed prop contents:
130130
```rust
131-
fn App(cx: Context, props: &()) -> Element {
131+
fn App(cx: Scope<()>) -> Element {
132132
let name = use_state(&cx, || String::from("example"));
133133
rsx!(cx, Child { title: name.as_str() })
134134
}
135135

136136
#[derive(Props)]
137137
struct ChildProps<'a> { title: &'a str }
138138

139-
fn Child(cx: Context, props: &ChildProps) -> Element {
139+
fn Child(cx: Scope<ChildProps>) -> Element {
140140
rsx!(cx, "Hello {cx.props.title}")
141141
}
142142
```
@@ -145,12 +145,12 @@ Global State
145145
```rust
146146
struct GlobalState { name: String }
147147

148-
fn App(cx: Context, props: &()) -> Element {
148+
fn App(cx: Scope<()>) -> Element {
149149
use_provide_shared_state(cx, || GlobalState { name: String::from("Toby") })
150150
rsx!(cx, Leaf {})
151151
}
152152

153-
fn Leaf(cx: Context, props: &()) -> Element {
153+
fn Leaf(cx: Scope<()>) -> Element {
154154
let state = use_consume_shared_state::<GlobalState>(cx)?;
155155
rsx!(cx, "Hello {state.name}")
156156
}
@@ -166,7 +166,7 @@ enum Route {
166166
Post(id)
167167
}
168168

169-
fn App(cx: Context, props: &()) -> Element {
169+
fn App(cx: Scope<()>) -> Element {
170170
let route = use_router(cx, Route::parse);
171171
cx.render(rsx!(div {
172172
{match route {
@@ -179,7 +179,7 @@ fn App(cx: Context, props: &()) -> Element {
179179

180180
Suspense
181181
```rust
182-
fn App(cx: Context, props: &()) -> Element {
182+
fn App(cx: Scope<()>) -> Element {
183183
let doggo = use_suspense(cx,
184184
|| async { reqwest::get("https://dog.ceo/api/breeds/image/random").await.unwrap().json::<Response>().await.unwrap() },
185185
|response| cx.render(rsx!( img { src: "{response.message}" }))

examples/async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async fn main() {
1111
dioxus::desktop::launch(App);
1212
}
1313

14-
pub static App: Component<()> = |cx| {
14+
pub static App: Component = |cx| {
1515
let count = use_state(&cx, || 0);
1616
let mut direction = use_state(&cx, || 1);
1717

0 commit comments

Comments
 (0)