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

Add asyncValue function #236

Closed
dxinteractive opened this issue Jul 23, 2019 · 1 comment
Closed

Add asyncValue function #236

dxinteractive opened this issue Jul 23, 2019 · 1 comment

Comments

@dxinteractive
Copy link
Collaborator

I find that now dataparcels can handle saving but not loading, that it seems strangely asymetrical. It wouldn't be hard to write a function that loads initial value from a promise:

// loadData returns a promise

useParcelState({
    value: asyncValue(loadData())
});

Can also pass down valueStatus (like how asyncSubmit passes down submitStatus). Can even contain a updateValue() function to update as though updateValue is true

@dxinteractive
Copy link
Collaborator Author

Released in v1.0.0

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

No branches or pull requests

1 participant