-
Notifications
You must be signed in to change notification settings - Fork 146
/
Copy pathvscode-snippets.json
117 lines (117 loc) · 2.77 KB
/
vscode-snippets.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
"console.log": {
"prefix": "con",
"body": ["console.log($0)"]
},
"css custom properties": {
"prefix": "var",
"body": ["var(--$0);"]
},
"const": {
"prefix": "const",
"body": ["const { $1 } = $0"]
},
"function": {
"prefix": "f",
"body": ["function $0() {", " ", "}"]
},
"getElementById('')": {
"prefix": "element",
"body": ["document.getElementById('$0')"]
},
"React.lazy": {
"prefix": "lazy",
"body": ["const $1 = React.lazy(() => import('$0'))"]
},
"Suspense": {
"prefix": "suspense",
"body": ["<Suspense fallback={<div>loading...</div>}>$0</Suspense>"]
},
"Props": {
"prefix": "Props",
"body": ["type Props = {", " ${0:children}: React.ReactNode", "}"]
},
"useState": {
"prefix": "state",
"body": ["const [${1}, set${1/(.*)/${1:/capitalize}/}] = useState($0)"]
},
"useEffect": {
"prefix": "effect",
"body": ["useEffect(() => {", " ${0}", "}, [])"]
},
"jsx": {
"prefix": "jsx",
"body": ["_jsx($0, {})"]
},
"children-prop-types": {
"prefix": "children",
"body": ["children: React.ReactNode"]
},
"useReducer": {
"prefix": "reducer",
"body": [
"const [state, dispatch] = useReducer((state, action) => {",
" switch(action.type) {",
" case '${0}': {",
" return { ...state }",
" }",
" default: return state",
" }",
"}, {})"
],
"description": "reducer -> useReducer"
},
"dispatch": {
"prefix": "dispatch",
"body": ["dispatch({ type: '${0}' })"]
},
"React: Class Component": {
"prefix": "class",
"body": [
"class $0 extends React.Component {",
" render() {",
" return (",
" <div></div>",
" )",
" }",
"}"
]
},
"Remix Export Links": {
"prefix": "exportlinks",
"body": ["export const links: LinksFunction = () => [{ rel: 'stylesheet', href: stylesheet }]"]
},
"Remix Export Headers": {
"prefix": "exportheaders",
"body": [
"export const headers: HeadersFunction = ({ actionHeaders, loaderHeaders, parentHeaders }) => ({",
" 'Cache-Control': 'max-age=300, s-maxage=3600',",
"})"
]
},
"Remix Export Meta": {
"prefix": "exportmeta",
"body": [
"export const meta: MetaFunction = () => {",
" return [",
" { title: 'Shopping App' },",
" {",
" name: 'description',",
" content: 'Our app description',",
" },",
" ]",
"}"
],
"description": ""
},
"Remix Export Loader": {
"prefix": "exportloader",
"body": [
"export const loader = async ({ params }: LoaderFunctionArgs) => {",
" return json({ })",
"}",
"",
"// useLoaderData<typeof loader>()"
]
}
}