Skip to content

Instantly share code, notes, and snippets.

@rhiokim
Forked from aaronshaf/quote.js
Created August 1, 2017 08:10
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/4477882e62d410c6a22d943e66a8e5b7 to your computer and use it in GitHub Desktop.
Save rhiokim/4477882e62d410c6a22d943e66a8e5b7 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>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment