Skip to content

Instantly share code, notes, and snippets.

@aaronshaf
Created October 12, 2015 17:57
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aaronshaf/547e520de2cfa2f38b1b to your computer and use it in GitHub Desktop.
Save aaronshaf/547e520de2cfa2f38b1b to your computer and use it in GitHub Desktop.
annotating a stateless function component in flowtype
/* @flow */
import React from 'react'
type QuoteProps = {
message: string,
quote: string,
name: string,
photoUrl: string,
photoAlt: string
}
export default ({
message,
quote,
name,
photoUrl,
photoAlt
}: QuoteProps): ReactElement => (
<div className='Quote'>
<div className='Quote-message'>
{message}
</div>
<div className='Quote-quote'>
<q>{quote}</q>
<div>— <cite>{name}</cite></div>
</div>
<div className='Quote-image-container'>
<img
className='Quote-image'
src={photoUrl}
alt={photoAlt}
/>
</div>
</div>
)
@kellyrmilligan
Copy link

👍

@TSMMark
Copy link

TSMMark commented Apr 25, 2018

For the record this is out of date now and visitors should look elsewhere. Potential good starting point here: https://medium.com/flow-type/even-better-support-for-react-in-flow-25b0a3485627

@HalfdanJ
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment