-
-
Save rhiokim/4477882e62d410c6a22d943e66a8e5b7 to your computer and use it in GitHub Desktop.
annotating a stateless function component in flowtype
This file contains hidden or 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' | |
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