Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useAsyncFn: keeping the previous state when start running the async function #934

Closed
echoulen opened this issue Jan 30, 2020 · 5 comments
Closed
Labels

Comments

@echoulen
Copy link
Contributor

Is your feature request related to a problem? Please describe.
the initialState.value of useAsyncFn will be clean when start running the async function

Describe the solution you'd like
keep the previous state unless loading property when start running the async function

echoulen added a commit to echoulen/react-use that referenced this issue Jan 30, 2020
@Granipouss
Copy link
Contributor

Hello there,

I feel like merging the state of various function executions can be a bit messy. Did you think about holding multiple states ? Maybe returning a state reference at each execution ?

What is your use case ?

Cheers,

@echoulen
Copy link
Contributor Author

Hi @Granipouss,

You are right, maybe I can custom the hook myself without modifying the useAsyncFn,

Actually I did, I will close the issue and PR if you feeling keeping the value will be a bit messy, it's fine for me.

@Granipouss
Copy link
Contributor

I would wait for other opinions before closing it all

@echoulen
Copy link
Contributor Author

echoulen commented Feb 5, 2020

This PR has been merged, close the issue.

@echoulen echoulen closed this as completed Feb 5, 2020
@streamich
Copy link
Owner

🎉 This issue has been resolved in version 15.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants