Skip to content

Conversation

@jamiebuilds
Copy link
Contributor

Resolves #1803

This will allow people to write stuff like:

class Component extends React.Component {
  async componentDidMount() {
    // ...
  }
}

@calebmer
Copy link
Contributor

Thank you!

@facebook-github-bot
Copy link
Contributor

@calebmer has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@capaj
Copy link

capaj commented Sep 23, 2017

@thejameskyle wouldn't it be better as void | Promise<void> instead of mixed?

IMHO it could be confusing for new react users if they see returns from these methods. We should encourage users not to return anything. Flow should warn about returns IMO.

@jamiebuilds
Copy link
Contributor Author

It doesn't really seem like the responsibility of Flow to enforce something that does not make a difference at runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow react components' lifecycle methods to be async

5 participants