Create a gist now

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.

Show comment
Hide comment
@geekf

geekf Mar 28, 2018

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

geekf commented Mar 28, 2018

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

@theneva

This comment has been minimized.

Show comment
Hide comment

theneva commented Mar 28, 2018

@geekf it's Flow

@simonbuchan

This comment has been minimized.

Show comment
Hide comment
@simonbuchan

simonbuchan Jul 2, 2018

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

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

@devCola

This comment has been minimized.

Show comment
Hide comment
@devCola

devCola Jul 10, 2018

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

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