Skip to content

Instantly share code, notes, and snippets.

@maypo
Created December 12, 2016 15:38
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 maypo/f55cd037f28f1e58931dca8b8f80c32a to your computer and use it in GitHub Desktop.
Save maypo/f55cd037f28f1e58931dca8b8f80c32a to your computer and use it in GitHub Desktop.
react snippets
'.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