Skip to content

Instantly share code, notes, and snippets.

@SPY
Last active October 3, 2016 09:42
Show Gist options
  • Save SPY/9037afe1b32ce2a99eaa6e1991e2b7e2 to your computer and use it in GitHub Desktop.
Save SPY/9037afe1b32ce2a99eaa6e1991e2b7e2 to your computer and use it in GitHub Desktop.
Code snippet for fast react class scafolding
{
"New React Class for CSP": {
"prefix": "new-react-csp",
"body": [
"import * as React from 'react'",
"import * as bem from 'csp-react/src/bem'",
"",
"export interface ${Component}Props extends React.Props<${Component}> {",
"\tclassName?: string | { toString(): string }",
"}",
"",
"interface ${Component}State extends React.Props<${Component}> { }",
"",
"const b = bem.block('${css-class}')",
"",
"export default class ${Component} extends React.Component<${Component}Props, ${Component}State> {",
"\trender() {",
"\t\treturn (",
"\t\t\t<div className={b.mix(this.props.className)}>",
"\t\t\t</div>",
"\t\t)",
"\t}",
"}"
],
"description": "New React Class for csp project"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment