Last active
August 7, 2017 04:08
-
-
Save dgowrie/ec4ea98cb4635c6b1848be150d0cb62b to your computer and use it in GitHub Desktop.
Sublime Text Snippet: React: class component
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
| <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