Skip to content

Unexpected error with use_future, use_effect hooks #1956

Answered by ealmloff
onweru asked this question in Q&A
Discussion options

You must be logged in to vote

The code you posted looks mostly correct. You can use use_resource instead of use_future if you want to return a value from the future:

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:
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:

dioxus = { git = "https://github.com/DioxusLabs/dioxus", rev = "3fef42a43bebcdfbce8717b8…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@onweru
Comment options

Answer selected by onweru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants