Last active
October 20, 2015 00:04
-
-
Save eriknyk/154b0126c2520774a169 to your computer and use it in GitHub Desktop.
Atom React snippets
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
# Your snippets | |
# | |
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to | |
# expand the prefix into a larger code block with templated values. | |
# | |
# You can create a new snippet in this file by typing "snip" and then hitting | |
# tab. | |
# | |
# An example CoffeeScript snippet to expand log to console.log: | |
# | |
# '.source.coffee': | |
# 'Console log': | |
# 'prefix': 'log' | |
# 'body': 'console.log $1' | |
# | |
# This file uses CoffeeScript Object Notation (CSON). | |
# If you are unfamiliar with CSON, you can read more about it here: | |
# https://github.com/bevry/cson#what-is-cson | |
'.source.js': | |
'React Import': | |
'prefix': 'rimport' | |
'body': 'import $1 from \'$2\';' | |
'React Constructor': | |
'prefix': 'rconstructor' | |
'body': """ | |
constructor (props) { | |
super(props); | |
$1 | |
} | |
""" | |
'React Class': | |
'prefix': 'rclass' | |
'body': """ | |
import React, { Component, PropTypes } from 'react'; | |
export default class $1 extends Component { | |
render () { | |
return ( | |
$2 | |
); | |
} | |
} | |
""" | |
'React Stateless component': | |
'prefix': 'rstatelesscomponent' | |
'body': """ | |
export const $1 = (props) => { | |
return $2; | |
}; | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment