Skip to content

Instantly share code, notes, and snippets.

@kellyrmilligan
Last active July 6, 2017 14:44
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 kellyrmilligan/a102a6fdf74b80af1caf921c7cc9a452 to your computer and use it in GitHub Desktop.
Save kellyrmilligan/a102a6fdf74b80af1caf921c7cc9a452 to your computer and use it in GitHub Desktop.
flow type example
// @flow
import React from 'react'
import classnames from 'classnames'
import type { ButtonT } from './ButtonT'
const Button = ({ className, type = 'button', text, tabIndex, onClick = () => {}, disabled = false }: ButtonT) => (
<button
className={classnames('button', className)}
type={type}
onClick={onClick}
disabled={disabled}
tabIndex={tabIndex}
>
{text}
</button>
)
export default Button
//ButtonT
// @flow
export type ButtonT = {
text: string,
className?: string,
type?: string,
onClick?: Function,
disabled?: boolean,
tabIndex?: number,
}
//flowconfig
[ignore]
.*/build/.*
.*/node_modules/stylelint/.*
.*/node_modules/eslint-plugin-jsx-a11y/.*
[include]
[libs]
[options]
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment