Last active
November 27, 2017 04:00
-
-
Save rhiokim/86bc1e6011ab8457bd4481ab8db654d1 to your computer and use it in GitHub Desktop.
Flowtype fundamentals with React.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React from 'react' | |
type Props = { | |
foo: number, | |
bar: string, | |
disabled: boolean, | |
children?: React.Element<any> | |
} | |
type State = { | |
foo: boolean | |
} | |
class A extends React.Component<Props, State> { | |
state = { | |
foo: false | |
} | |
render () { | |
const { foo } = this.state | |
return ( | |
<div> | |
<h1>Title</h1> | |
<span>Component State: {foo}</span> | |
{this.props.children} | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment