Skip to content

Instantly share code, notes, and snippets.

@dgowrie
Last active August 7, 2017 04:08
Show Gist options
  • Select an option

  • Save dgowrie/ec4ea98cb4635c6b1848be150d0cb62b to your computer and use it in GitHub Desktop.

Select an option

Save dgowrie/ec4ea98cb4635c6b1848be150d0cb62b to your computer and use it in GitHub Desktop.
Sublime Text Snippet: React: class component
<snippet>
<content><![CDATA[
import React from 'react';
import PropTypes from 'prop-types';
const propTypes = {
name: PropTypes.string,
};
class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:ComponentName}} extends React.Component {
constructor(props) {
super(props);
this.state = {};
// bind events
// this.handler = this.handler.bind(this);
}
render() {
return (
${3:<div>${0}</div>}
);
}
};
${1:${TM_FILENAME/(.+)\..+|.*/$1/:ComponentName}}.propTypes = propTypes
export default ${1:${TM_FILENAME/(.+)\..+|.*/$1/:ComponentName}};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>react-cc</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
<description>React: class component</description>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment