Skip to content

Commit b5a0f35

Browse files
authored
feat: Improve snippet for TS Functional component (#55)
* 🐛 fix: ts functional component * 🐛 fix: newline * 🐛 fix: type import
1 parent 4993740 commit b5a0f35

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

packages/vscode/snippets/react-typescript.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@
2222
"rfct": {
2323
"prefix": "rfct",
2424
"body": [
25-
"import React from \"react\";",
25+
"import type { FC } from 'react'",
2626
"",
27-
"interface I${1:${TM_FILENAME_BASE}}Props {}",
27+
"interface ${TM_FILENAME_BASE}Props {}",
2828
"",
29-
"function ${1:${TM_FILENAME_BASE}}({}: I${1:${TM_FILENAME_BASE}}Props): JSX.Element {",
30-
" return <div></div>;",
31-
"}",
32-
"",
33-
"export default ${1:${TM_FILENAME_BASE}};"
29+
"export const $TM_FILENAME_BASE: FC<${TM_FILENAME_BASE}Props> = ({$2}) => {",
30+
"\t\treturn ($3);",
31+
"}"
3432
],
3533
"description": "Typescript: React functional component"
3634
},

0 commit comments

Comments
 (0)