Skip to content

Instantly share code, notes, and snippets.

@dygufa
Last active December 18, 2017 22:05
Show Gist options
  • Save dygufa/d7837a570143ea25a135e99c52fa20c1 to your computer and use it in GitHub Desktop.
Save dygufa/d7837a570143ea25a135e99c52fa20c1 to your computer and use it in GitHub Desktop.
React + MobX + Typescript Component Snippet
{
"Typescript react component with Mobx": {
"prefix": "tsrcm",
"body": [
"import * as React from \"react\";",
"import { observable } from \"mobx\";",
"import { observer, inject } from \"mobx-react\";",
"",
"interface I${1:ComponentName}Props {}",
"",
"interface I${1:ComponentName}State {}",
"",
"@inject()",
"@observer",
"class ${1:ComponentName} extends React.Component<I${1:ComponentName}Props, I${1:ComponentName}State> {",
"\tpublic render() {",
"\t\treturn (",
"\t\t\t${2:<div>Oi :)</div>}",
"\t\t);",
"\t}",
"}",
"",
"export default ${1:ComponentName};",
""
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment