Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Resolving promises in onEnter() #74

Open
tanis2000 opened this issue Mar 22, 2017 · 0 comments
Open

Resolving promises in onEnter() #74

tanis2000 opened this issue Mar 22, 2017 · 0 comments

Comments

@tanis2000
Copy link

Is there any way to resolve promises in onEnter() when calling it from the server? I'd like my components to fetch some data before rendering but I'm facing an issue.

If I add the fetch data stuff as a promise with something along the line of store.dispatch(loadData()); it works fine on the client but since it returns a Promise, it doesn't work on the server.

On the other hand if I move the code of my loadData function directly into onEnter it does get called on the server as well as I'm calling fetch() directly instead of returning it, but then React complains that the HTML being created on the client is different from the one on the server.

Is there a smart way to accomplish this?

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

No branches or pull requests

1 participant