Merge pull request #475 from raunofreiberg/react-flow-minimal

[flow] modify minimal example to typing React components
This commit is contained in:
Rico Sta. Cruz 2018-05-14 09:22:19 +08:00 committed by GitHub
commit bb9034d9ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
}
```