Skip to content

Instantly share code, notes, and snippets.

@ryuichi24
Created February 12, 2023 09:18
Show Gist options
  • Select an option

  • Save ryuichi24/471d7b8afedab45adc582a0bb8e0fcc0 to your computer and use it in GitHub Desktop.

Select an option

Save ryuichi24/471d7b8afedab45adc582a0bb8e0fcc0 to your computer and use it in GitHub Desktop.

Revisions

  1. ryuichi24 created this gist Feb 12, 2023.
    33 changes: 33 additions & 0 deletions typescriptreact.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    {
    "console.log": {
    "prefix": "clg",
    "body": ["console.log($1)"]
    },
    "template for React Function Component": {
    "prefix": "rf",
    "body": [
    "import React from 'react'",
    "",
    "type ${TM_FILENAME_BASE}Props = {",
    "$1",
    "}",
    "",
    "export const $TM_FILENAME_BASE: React.FC<${TM_FILENAME_BASE}Props> = ({$2}) => {",
    "\t\treturn (<>${TM_FILENAME_BASE}</>);",
    "}"
    ],
    "description": "Typescript React Function Component"
    },
    "template for useState": {
    "prefix": "us",
    "body": ["const [$1, set${1/(.)/${1:/upcase}/}] = useState<$2>($3);"]
    },
    "template for export all": {
    "prefix": "ex",
    "description": "export statement to export all items from module",
    "body": [
    "export * from \"$1\";",
    ""
    ]
    }
    }