Last active
August 16, 2020 04:56
-
-
Save Robbie-Cook/89eda57c4a8b68eb426c9c78bcb32320 to your computer and use it in GitHub Desktop.
React Component Snippet
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
| { | |
| "component": { | |
| "scope": "typescriptreact", | |
| "prefix": ["component", "styled-component"], | |
| "body": [ | |
| "/** @jsx jsx */", | |
| "import { css, jsx } from \"@emotion/core\"", | |
| "import React from \"react\"", | |
| "", | |
| "/**", | |
| " * Interface for ${1:Component} props", | |
| " */", | |
| "interface ${1:Component}Props {", | |
| " children?: any;", | |
| "}", | |
| "", | |
| "/**", | |
| " * A ${1:Component} component.", | |
| " */", | |
| "const ${1:Component}: React.FC<${1:Component}Props> = (props) => {", | |
| " return <div css={css``}>${1:Component} component</div>", | |
| "}", | |
| "", | |
| "export default ${1:Component};" | |
| ], | |
| "description": "Creates a quick styled component" | |
| }, | |
| "class": { | |
| "scope": "typescript", | |
| "prefix": ["class", "typescript-class"], | |
| "body": [ | |
| "", | |
| "/**", | |
| " * Interface for ${1:Class}", | |
| " */", | |
| "interface I${1:Class} {", | |
| " ", | |
| "};", | |
| "", | |
| "/**", | |
| " * A ${1:Class}.", | |
| " */", | |
| "export default class ${1:Class} implements I${1:Class} {", | |
| " constructor() {", | |
| " }", | |
| "}", | |
| "", | |
| ], | |
| "description": "Creates a quick class" | |
| } | |
| } |
Author
Author
Also, I have now added a class snippet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a snippet of a Typescript and emotion component based off Martin Adams's.