Skip to content

Commit

Permalink
split modules
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-fe committed Dec 27, 2017
1 parent 4426f92 commit 8896d42
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 59 deletions.
65 changes: 6 additions & 59 deletions snippets/js.cson
Expand Up @@ -3,63 +3,10 @@
'prefix': 'af'
'body': '($1) => {}'

'import react':
'prefix': 'ireact'
'body': 'import * as React from \'react\';'
'console log':
'prefix': 'log'
'body': 'console.log($1)'

'react class component':
'prefix': 'ccomp'
'body': '''
class $1 extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return $2;
}
}
'''

'componentDidMount':
'prefix': 'cdm'
'body': 'componentDidMount() {}'

'componentDidUpdate':
'prefix': 'cdu'
'body': 'componentDidUpdate() {}'

'componentDidCatch':
'prefix': 'cdc'
'body': 'componentDidCatch() {}'

'componentWillMount':
'prefix': 'cwm'
'body': 'componentWillMount() {}'

'componentWillUnmount':
'prefix': 'cum'
'body': 'componentWillUnmount() {}'

'componentWillReceiveProps':
'prefix': 'cwrp'
'body': 'componentWillReceiveProps() {}'

'componentWillUpdate':
'prefix': 'cwu'
'body': 'componentWillUpdate() {}'

'shouldComponentUpdate':
'prefix': 'scu'
'body': 'shouldComponentUpdate() {}'

'this.setState':
'prefix': 'setstate'
'body': '''
this.setState((prevState, props) => {
return {
$1: $2
};
})
'''
'console error':
'prefix': 'err'
'body': 'console.error($1)'
102 changes: 102 additions & 0 deletions snippets/react.cson
@@ -0,0 +1,102 @@
'.source.js':
'import react':
'prefix': 'ireact'
'body': 'import * as React from \'react\';'

'react class component':
'prefix': 'ccomp'
'body': '''
class $1 extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return $2;
}
}
$3
'''

'componentDidMount':
'prefix': 'cdm'
'body': '''
componentDidMount() {
$1
}
$2
'''

'componentDidUpdate':
'prefix': 'cdu'
'body': '''
componentDidUpdate() {
$1
}
$2
'''

'componentDidCatch':
'prefix': 'cdc'
'body': '''
componentDidCatch() {
$1
}
$2
'''

'componentWillMount':
'prefix': 'cwm'
'body': '''
componentWillMount() {
$1
}
$2
'''

'componentWillUnmount':
'prefix': 'cum'
'body': '''
componentWillUnmount() {
$1
}
$2
'''

'componentWillReceiveProps':
'prefix': 'cwrp'
'body': '''
componentWillReceiveProps() {
$1
}
$2
'''

'componentWillUpdate':
'prefix': 'cwu'
'body': '''
componentWillUpdate() {
$1
}
$2
'''

'shouldComponentUpdate':
'prefix': 'scu'
'body': '''
shouldComponentUpdate() {
$1
}
$2
'''

'this.setState':
'prefix': 'setstate'
'body': '''
this.setState((prevState, props) => {
return {
$1: $2
};
})
'''

0 comments on commit 8896d42

Please sign in to comment.