Skip to content

Instantly share code, notes, and snippets.

@maypo
Created Dec 12, 2016
Embed
What would you like to do?
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