-
I know this might be too soon but maybe there's someone who can guide me. If not, I will wait for I'm trying out the changes in the main branch, mainly to test #1791. I'm using the web launcher and so far most things work well. Some hooks e.g use_effect, use_future throw errors. checking through the source and examples, it appears that scope and deps are no longer needed as arguments. But I still get
I'm curious if my Cargo.toml file 👇🏼 is the issue or some other things I missed.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The code you posted looks mostly correct. You can use let resource = use_resource(move || async move {
get_items(endpoint).await.json::<T>().await
}); If you are using rust analyzer, you might need to restart your editor to get an updated error after changing the version. Some other 0.5 resources/changes: In 0.5, you also don't need a separate dependency for the renderer, router and html crates: dioxus = { git = "https://github.com/DioxusLabs/dioxus", rev = "3fef42a43bebcdfbce8717b8c99915f93403c4d8", features = ["web", "router"] } use dioxus::prelude::*;
fn main() {
launch(|| rsx! { Router<Route> {} })
} |
Beta Was this translation helpful? Give feedback.
The code you posted looks mostly correct. You can use
use_resource
instead ofuse_future
if you want to return a value from the future:If you are using rust analyzer, you might need to restart your editor to get an updated error after changing the version.
Some other 0.5 resources/changes:
The docs for 0.5 are updated here. They include a migration guide to help you update from 0.4 -> 0.5 which might be useful.
In 0.5, you also don't need a separate dependency for the renderer, router and html crates: