Last active
June 15, 2023 04:12
-
-
Save hmtri1011/8b46cfcfcdbeccc369a0f82f474c7833 to your computer and use it in GitHub Desktop.
VSCode TypeScript snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Place your snippets for typescriptreact here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
"TypeScript React Function Component": { | |
"prefix": "rsct", | |
"body": [ | |
"export interface ${TM_FILENAME_BASE}Props$1 {}", | |
"", | |
"export const $TM_FILENAME_BASE$2 = (props : ${TM_FILENAME_BASE}Props) => {", | |
"\treturn (<div />$3);", | |
"}", | |
"" | |
], | |
"description": "TypeScript React Function Component" | |
}, | |
"NextJS Server Component Page": { | |
"prefix": "rscp", | |
"body": [ | |
"", | |
"export default function Page() {", | |
"\treturn <>$1</>;", | |
"}", | |
"" | |
], | |
"description": "NextJS Server Component Page" | |
}, | |
"React Native StyleSheet": { | |
"prefix": "rnss", | |
"body": [ | |
"import React from 'react'", | |
"import { StyleSheet } from 'react-native'", | |
"", | |
"export interface ${TM_FILENAME_BASE}Props$1 {}", | |
"const $TM_FILENAME_BASE$2: React.FC<${TM_FILENAME_BASE}Props> = () => {", | |
"\t\treturn (<View />$3);", | |
"}", | |
"", | |
"const styles = StyleSheet.create({", | |
"", | |
"});", | |
"", | |
"export default $TM_FILENAME_BASE" | |
], | |
"description": "React Native StyleSheet" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment