Skip to content

Commit b220eea

Browse files
authored
Merge pull request #8 from milannankov/master
Added a new snippet for stateful component with Props, State, and constructor
2 parents 6cf5955 + 494d2ac commit b220eea

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Below is a list of all available snippets and the triggers of each one. The **
2727
| Trigger | Content |
2828
| -------: | ------- |
2929
| `tsrcc→` | `class component skeleton` |
30+
| `tsrcfull→` | `class component skeleton with Props, State, and constructor` |
3031
| `tsrcjc→`| `class component skeleton without import and default export lines` |
3132
| `tsrpcc→`| `class purecomponent skeleton` |
3233
| `tsrpcjc→` | `class purecomponent without import and default export lines` |

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vscode-react-typescript",
3-
"version": "1.0.10",
3+
"version": "1.0.20",
44
"description": "Code snippets for react in typescript",
55
"displayName": "Typescript React code snippets",
66
"publisher": "infeng",

snippets/snippets.json

+34-3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,43 @@
2020
],
2121
"description": "Create a React Component with typescript."
2222
},
23+
"React Component - Full": {
24+
"prefix": "tsrcfull",
25+
"body": [
26+
"import * as React from 'react';",
27+
"",
28+
"export interface ${1:App}Props {",
29+
"}",
30+
"",
31+
"export interface ${1:App}State {",
32+
"}",
33+
"",
34+
"export default class ${1:} extends React.Component<${1:}Props, ${1:}State> {",
35+
" constructor(props: ${1:}Props) {",
36+
" super();",
37+
"",
38+
" this.state = {",
39+
" }",
40+
" }",
41+
"",
42+
" render() {",
43+
" return (",
44+
" <div>",
45+
" ${2:}",
46+
" </div>",
47+
" );",
48+
" }",
49+
"}",
50+
""
51+
],
52+
"description": "Create a stateful React Component with typescript with Props, State, and a constructor."
53+
},
2354
"React Component without import and export": {
2455
"prefix": "tsrcjc",
2556
"body": [
2657
"export interface ${1:App}Props {",
2758
"}",
28-
"",
59+
"",
2960
"class ${1:} extends React.Component<${1:}Props, any> {",
3061
" render() {",
3162
" return (",
@@ -65,7 +96,7 @@
6596
"body": [
6697
"export interface ${1:App}Props {",
6798
"}",
68-
"",
99+
"",
69100
"class ${1:} extends React.PureComponent<${1:}Props, any> {",
70101
" render() {",
71102
" return (",
@@ -86,7 +117,7 @@
86117
"",
87118
"export interface ${1:App}Props {",
88119
"}",
89-
"",
120+
"",
90121
"export function ${1:} (props: ${1:}Props) {",
91122
" return (",
92123
" <div>",

0 commit comments

Comments
 (0)