Created
February 16, 2017 09:00
-
-
Save johncmunson/fa5d46488e48ee2c34e2ed818370900b to your computer and use it in GitHub Desktop.
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
'JSX comment': | |
'prefix': 'reJSXComment' | |
'body': '{/* ${1:Comments...} */}' | |
'ReactDOM.render': | |
'prefix': 'reDOMRender' | |
'body': 'ReactDOM.render(${1:<App />}, document.getElementById(\'${2:root}\'));' | |
'class component w/ extras': | |
'prefix': 'reCompFull' | |
'body': """ | |
class ${1:Component} extends React.Component { | |
static propTypes = { | |
// require and typecheck certain props | |
} | |
static defaultProps = { | |
// set defaults | |
} | |
autoBoundMethod = () => { | |
// use with {this.autoBoundMethod} | |
} | |
constructor(props) { | |
super(props) | |
this.state = { | |
// set initial state | |
} | |
} | |
componentWillMount() { | |
} | |
componentDidMount() { | |
// make API calls here | |
} | |
componentWillReceiveProps(newProps) { | |
} | |
shouldComponentUpdate(newProps, newState) { | |
} | |
componentWillUpdate(nextProps, nextState) { | |
} | |
componentDidUpdate(prevProps, prevState) { | |
} | |
componentWillUnmount() { | |
} | |
render() { | |
return ( | |
${2:<div></div>} | |
); | |
} | |
} | |
""" | |
'class component': | |
'prefix': 'reCompClass' | |
'body': """ | |
class ${1:Component} extends React.Component { | |
render() { | |
return ( | |
${2:<div></div>} | |
); | |
} | |
} | |
""" | |
'functional component': | |
'prefix': 'reCompFunc' | |
'body': """ | |
const ${1:Component} = (props) => ( | |
${2:<div></div>} | |
); | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment