Skip to content

Commit

Permalink
Merge pull request #147 from gramidt/fix/guide-issues
Browse files Browse the repository at this point in the history
Fix minor typos and consistency issues within the Guide
  • Loading branch information
ealmloff authored Oct 16, 2023
2 parents d8227ac + eef6025 commit 708878c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs-src/0.4/en/guide/full_code.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Conclusion

Well done! You've completed the Dioxus guide and built a hackernews application in Dioxus.
Well done! You've completed the Dioxus guide and built a hackernews application in Dioxus.

To continue your journey, you can attempt a challenge listed below, or look at the [Dioxus reference](../reference/index.md).

## Challenges
Expand Down
2 changes: 1 addition & 1 deletion docs-src/0.4/en/guide/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Let's create a [`onmouseenter`](https://docs.rs/dioxus/latest/dioxus/events/fn.o
## State

So far our components have had no state like a normal rust functions. To make our application change when we hover over a link we need state to store the currently hovered link in the root of the application.
So far our components have had no state like normal rust functions. To make our application change when we hover over a link we need state to store the currently hovered link in the root of the application.

You can create state in dioxus using hooks. Hooks are Rust functions that take a reference to `ScopeState` (in a component, you can pass `cx`), and provide you with functionality and state.

Expand Down
3 changes: 2 additions & 1 deletion src/doc_examples/hackernews_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub static USER_API: &str = "user/";
const COMMENT_DEPTH: i64 = 2;

pub async fn get_story_preview(id: i64) -> Result<StoryItem, reqwest::Error> {
let url = format!("{}item/{}.json", BASE_API_URL, id);
let url = format!("{}{}{}.json", BASE_API_URL, ITEM_API, id);
reqwest::get(&url).await?.json().await
}

Expand Down Expand Up @@ -362,6 +362,7 @@ fn StoryListing(cx: Scope, story: StoryItem) -> Element {
id,
..
} = story;
// New
let full_story = use_ref(cx, || None);

let url = url.as_deref().unwrap_or_default();
Expand Down
2 changes: 1 addition & 1 deletion src/doc_examples/hackernews_complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ pub static USER_API: &str = "user/";
const COMMENT_DEPTH: i64 = 2;

pub async fn get_story_preview(id: i64) -> Result<StoryItem, reqwest::Error> {
let url = format!("{}item/{}.json", BASE_API_URL, id);
let url = format!("{}{}{}.json", BASE_API_URL, ITEM_API, id);
reqwest::get(&url).await?.json().await
}

Expand Down

0 comments on commit 708878c

Please sign in to comment.