8000 Example with remote data fetching · Issue #113 · storeon/storeon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Example with remote data fetching #113

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

Open
sebastienfi opened this issue Jun 26, 2020 · 2 comments
Open

Example with remote data fetching #113

sebastienfi opened this issue Jun 26, 2020 · 2 comments

Comments

@sebastienfi
Copy link

Anyone with an example implementing storeon with remote data fetching? I've come across the great swr lib, how would you implement both?

@ai
Copy link
Member
ai commented Jun 26, 2020
store.on('@users/load', async () => {
  let users = await fetch('/users/')
  store.dispatch('@users/set', { users })
})

store.on('@users/set', async (state, users) => {
  return { users }
})

Do you want to send PR and add a section to the docs?

@sebastienfi
Copy link
Author

@ai I'll do this.
Thanks for improving the doc!

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

No branches or pull requests

2 participants
0