Skip to content

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
Copy link

geekf commented Mar 28, 2018

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

@theneva
Copy link

theneva commented Mar 28, 2018

@geekf it's Flow

@simonbuchan
Copy link

simonbuchan commented Jul 2, 2018

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

@devCola
Copy link

devCola commented Jul 10, 2018

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

@oshalygin
Copy link

oshalygin commented Jan 15, 2019

This is Flow

@eugeneblog
Copy link

eugeneblog commented Jun 4, 2020

How to define Snapshot?

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