Created
December 12, 2016 15:38
-
-
Save maypo/f55cd037f28f1e58931dca8b8f80c32a to your computer and use it in GitHub Desktop.
react snippets
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
'.source.js': | |
'React es6 class': | |
'prefix': '_re6c' | |
'body': """ | |
import React from \'react\'; | |
export default class ${1:XXX} extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
const { ${2:xxxArray} ${3:xxxString} ${4:xxxObject} } = this.props; | |
return ( | |
<div className=""> | |
XXX | |
</div> | |
); | |
} | |
} | |
${1:XXX}.propTypes = { | |
${2:xxxArray}: React.PropTypes.array, | |
${3:xxxString}: React.PropTypes.string, | |
${4:xxxObject}: React.PropTypes.object, | |
}; | |
""" | |
'React es6 stateless function': | |
'prefix': '_re6sf' | |
'body': """ | |
import React from \'react\'; | |
const ${1:XXX} = (\{ ${2:xxxObject} \}) => ( | |
<div className=""> | |
xxx | |
</div> | |
) | |
${1:XXX}.propTypes = { | |
${2:xxxObject}: React.PropTypes.object, | |
}; | |
export default ${1:XXX}; | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment