Last active
June 5, 2016 23:20
-
-
Save mattjstar/9a12073e28090a173098e4ab1f4bc033 to your computer and use it in GitHub Desktop.
Presentational Components
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
import React from 'react'; | |
import style from '../typography/typography.scss'; | |
class Paragraph extends React.Component { | |
render() { | |
return ( | |
<p className={style.para}>{this.props.children}</p> | |
); | |
} | |
} | |
Paragraph.propTypes = { | |
children: React.PropTypes.string.isRequired, | |
}; | |
export default Paragraph; | |
// CAN BE REWRITTEN AS A STATELESS FUNCTIONAL COMPONENT (no life cycles or local state): | |
import React from 'react'; | |
import style from '../typography/typography.scss'; | |
const Paragraph = ({children}) => { | |
return ( | |
<p className={style.para}>{children}</p> | |
); | |
} | |
export default Paragraph; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment