Skip to content

Instantly share code, notes, and snippets.

@Robbie-Cook
Last active August 16, 2020 04:56
Show Gist options
  • Select an option

  • Save Robbie-Cook/89eda57c4a8b68eb426c9c78bcb32320 to your computer and use it in GitHub Desktop.

Select an option

Save Robbie-Cook/89eda57c4a8b68eb426c9c78bcb32320 to your computer and use it in GitHub Desktop.
React Component Snippet
{
"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"
}
}
@Robbie-Cook
Copy link
Author

This is a snippet of a Typescript and emotion component based off Martin Adams's.

@Robbie-Cook
Copy link
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