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

Resolving promises in onEnter() #74

@tanis2000

Description

@tanis2000

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions