Created
September 7, 2017 03:55
-
-
Save doanhpv-0200/0e918d71e25de9d243b8ccc1111090ca to your computer and use it in GitHub Desktop.
Atom Snippets for React
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
| '.source.js': | |
| 'New React Class': | |
| 'prefix': 'new-react-class' | |
| 'body': ''' | |
| import React from 'react'; | |
| class ${1:App} extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| } | |
| render() { | |
| return ( | |
| <div>${2:Hello World!}</div> | |
| ) | |
| } | |
| } | |
| export default ${1:App}; | |
| ''' | |
| 'New React Component': | |
| 'prefix': 'new-react-component' | |
| 'body': ''' | |
| import React from 'react'; | |
| export${1: default} const ${2:Component} = (props) => ( | |
| <div>${3:Hello World!}</div> | |
| ) | |
| ''' | |
| 'propTypes': | |
| 'prefix': 'set-proptypes' | |
| 'body': ''' | |
| ${1:Test}.propTypes = { | |
| ${2:name}: PropTypes.${3:string}${4:.isRequired} | |
| } | |
| ''' | |
| 'defaultProps': | |
| 'prefix': 'set-default-props' | |
| 'body': ''' | |
| ${1:Test}.defaultProps = { | |
| ${2:name}: ${3:'test'} | |
| } | |
| ''' | |
| 'Import Something': | |
| 'prefix': 'import' | |
| 'body': "import $1 from '$2';\n" | |
| 'Import React': | |
| 'prefix': 'import-react' | |
| 'body': "import React from 'react';\n" | |
| 'Import ReactDOM': | |
| 'prefix': 'import-react-dom' | |
| 'body': "import ReactDOM from 'react-dom';\n" | |
| 'Import Moment': | |
| 'prefix': 'import-moment' | |
| 'body': "import moment from 'moment';\n" | |
| 'Import Toastr': | |
| 'prefix': 'import-toastr' | |
| 'body': "import toastr from 'toastr';\n" | |
| 'Import jQuery': | |
| 'prefix': 'import-jquery' | |
| 'body': "import \$ from 'jquery';\n" | |
| 'Import Lodash': | |
| 'prefix': 'import-lodash' | |
| 'body': "import \_ from 'lodash';\n" | |
| 'Import Lodash Component': | |
| 'prefix': 'import-lodash-component' | |
| 'body': "import ${1:map} from 'lodash/${1:map}';\n" | |
| 'Import PropType': | |
| 'prefix': 'import-prop-types' | |
| 'body': "import PropTypes from 'prop-types';\n" | |
| 'For loop': | |
| 'prefix': 'for-loop' | |
| 'body': ''' | |
| for (let ${1:i} = 0; ${1:i} < ${2:aihih}; ${1:i}++) { | |
| ${3:console.log('test')} | |
| }\n | |
| ''' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment