You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.
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?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 callingfetch()
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?
The text was updated successfully, but these errors were encountered: