Last active
July 6, 2017 14:44
-
-
Save kellyrmilligan/a102a6fdf74b80af1caf921c7cc9a452 to your computer and use it in GitHub Desktop.
flow type example
This file contains 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' | |
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