Instantly share code, notes, and snippets.

Embed
What would you like to do?
class Example extends React.Component<
Props,
State,
Snapshot
> {
static getDerivedStateFromProps(
nextProps: Props,
prevState: State
): $Shape<State> | null {
// ...
}
getSnapshotBeforeUpdate(
prevProps: Props,
prevState: State
): Snapshot {
// ...
}
}
@geekf

This comment has been minimized.

geekf commented Mar 28, 2018

Stupid question, but is this TypeScript? The file extensions says .js.

@theneva

This comment has been minimized.

theneva commented Mar 28, 2018

@geekf it's Flow

@simonbuchan

This comment has been minimized.

simonbuchan commented Jul 2, 2018

Replace $Shape with Partial and you have typescript, though.

@devCola

This comment has been minimized.

devCola commented Jul 10, 2018

@simonbuchan just wondering... will Flow and Typescript merge?

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