Created
January 24, 2019 22:51
-
-
Save ratbeard/ef8daf56110d7e131d4bf29fe4125dcf 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
{ | |
"React component": { | |
"prefix": "com", | |
"body": [ | |
"import React, { Component } from 'react';", | |
"", | |
"interface Props {", | |
" $3", | |
"}", | |
"", | |
"export class ${1} extends Component<Props> {", | |
" render() {", | |
" const {} = this.props;", | |
" ", | |
" return (", | |
" <div>", | |
" ${2:$1}", | |
" </div>", | |
" );", | |
" }", | |
"}", | |
"" | |
], | |
"description": "Create a React Component with typescript." | |
}, | |
"React component with state": { | |
"prefix": "coms", | |
"body": [ | |
"import React, { Component } from 'react';", | |
"", | |
"interface Props {", | |
" $3", | |
"}", | |
"", | |
"const initialState = {", | |
" $4", | |
"}", | |
"", | |
"export class ${1} extends Component<Props, typeof initialState> {", | |
" state = initialState;", | |
"", | |
" render() {", | |
" const {} = this.props;", | |
"", | |
" return (", | |
" <div>", | |
" ${2:$1}", | |
" </div>", | |
" );", | |
" }", | |
"}", | |
"" | |
], | |
"description": "Create a React Component with initialState with typescript." | |
}, | |
"Destructure this.props": { | |
"prefix": "pr", | |
"body": [ | |
"const { $1 } = this.props;" | |
], | |
"description": "Destructure this.props" | |
}, | |
"Destructure this.state": { | |
"prefix": "st", | |
"body": [ | |
"const { $1 } = this.state;" | |
], | |
"description": "Destructure this.state" | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment