[flow] modify minimal example to typing React components

This commit is contained in:
raunofreiberg 2018-03-29 14:19:18 +03:00
parent 9bb866cf36
commit 545c82fc89
1 changed files with 9 additions and 6 deletions

15
flow.md
View File

@ -325,13 +325,16 @@ function add(n /*: number */) { ... }
### React
```js
React$Element<any>
```
type Props = {
bar: number,
}
```js
class Foo extends React.Component {
/*:: state: { open: boolean } */
/*:: props: { open: boolean } */
type State = {
open: boolean,
}
class Foo extends React.Component<Props, State> {
// Component code
}
```