Skip to content

Instantly share code, notes, and snippets.

@rrharvey
Last active May 22, 2017 18:47
Show Gist options
  • Save rrharvey/32576d26e21b4ab2b3d51485da095365 to your computer and use it in GitHub Desktop.
Save rrharvey/32576d26e21b4ab2b3d51485da095365 to your computer and use it in GitHub Desktop.
Visual Studio Code snippets for React using TypeScript
{
"Import React": {
"prefix": "impr",
"body": [
"import * as React from 'react';",
"$0"
]
},
"Import ReactDOM": {
"prefix": "imprd",
"body": [
"import * as ReactDOM from 'react-dom';",
"$0"
]
},
"Import classNames": {
"prefix": "impcn",
"body": [
"import * as classNames from 'classnames';",
"$0"
]
},
"React Pure Functional Component": {
"prefix": "rsfc",
"body": [
"interface ${1:name}Props {",
"}",
"",
"const ${1:name}: React.SFC<${1:name}Props> = (props) => <div />$0;",
"",
"export default ${1:name};",
""
],
"description": "Create a React stateless functional component."
},
"React Class Component": {
"prefix": "rcc",
"body": [
"interface ${1:name}Props {",
"}",
"",
"class ${1:name} extends React.Component<${1:name}Props, null> {",
"\trender() {",
"\t\treturn <div/>$0;",
"\t}",
"}",
"",
"export default ${1:name};",
""
],
"description": "Create a React component class."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment