Skip to content

Allow react components' lifecycle methods to be async #1803

@jakpaw

Description

@jakpaw

I tried to declare componentWillMount in a component as async but got a flow error: Promise This type is incompatible with undefined. I found out that it's caused by this definition:

componentWillMount(): void;

in https://github.com/facebook/flow/blob/master/lib/react.js

Shouldn't it be possible for components' lifecycle methods which return void to return a Promise instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions