Skip to content

Instantly share code, notes, and snippets.

@rhiokim
Last active November 27, 2017 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhiokim/86bc1e6011ab8457bd4481ab8db654d1 to your computer and use it in GitHub Desktop.
Save rhiokim/86bc1e6011ab8457bd4481ab8db654d1 to your computer and use it in GitHub Desktop.
Flowtype fundamentals with React.js
// @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