Created
March 22, 2016 22:11
-
-
Save scott-riley/ab43f2df55529e2b62ff to your computer and use it in GitHub Desktop.
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
# Put me in ~/.atom/snippets.cson | |
'.source.js': | |
'import connect': | |
'prefix': 'cn' | |
'body': "import {connect} from 'react-redux';" | |
'export connect': | |
'prefix': 'ecn' | |
'body': "export default connect(mapStateToProps)(${1:MyComponent});" | |
'import React + Component': | |
'prefix': 'irc' | |
'body': "import React, {Component} from 'react';" | |
'React render w/ children': | |
'prefix': 'rrc' | |
'body': """ | |
render() { | |
const {children} = this.props; | |
return ( | |
<div> | |
{children} | |
</div> | |
); | |
} | |
""" | |
'React render empty': | |
'prefix': 'rre' | |
'body': """ | |
render() { | |
return ( | |
<${1:MyComponent} /> | |
); | |
} | |
""" | |
'React class component': | |
'prefix': 'edc' | |
'body': """ | |
export default class ${1:MyComponent} extends Component { | |
$2 | |
} | |
""" | |
'Map state to props': | |
'prefix': 'mstp' | |
'body': """ | |
function mapStateToProps(state) { | |
return { | |
${1:myProp}: state.${2:myProp} | |
} | |
} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment