|
6 | 6 | ], |
7 | 7 | "description": "React useState() hook" |
8 | 8 | }, |
9 | | - "useTransition": { |
10 | | - "prefix": "uth", |
11 | | - "body": [ |
12 | | - "const [isPending, startTransition] = useTransition();$0" |
13 | | - ], |
14 | | - "description": "React useTransition() hook" |
15 | | - }, |
16 | | - "useDeferredValue": { |
17 | | - "prefix": "udvh", |
18 | | - "body": [ |
19 | | - "const ${1:deferredValue} = useDeferredValue(${2:value});$0" |
20 | | - ], |
21 | | - "description": "React useDeferredValue() hook" |
22 | | - }, |
23 | | - "useDebugValue": { |
24 | | - "prefix": "udbvh", |
| 9 | + "useReducer": { |
| 10 | + "prefix": "urdh", |
25 | 11 | "body": [ |
26 | | - "useDebugValue(${1:value});$0" |
| 12 | + "const [${1:state},${2: dispatch}] = useReducer(${3:reducer}, ${4:initialArg}, ${5:init});" |
27 | 13 | ], |
28 | | - "description": "React useDebugValue() hook" |
| 14 | + "description": "React useReducer() hook" |
29 | 15 | }, |
30 | | - "useId": { |
31 | | - "prefix": "uidh", |
| 16 | + "useContext": { |
| 17 | + "prefix": "uch", |
32 | 18 | "body": [ |
33 | | - "const ${1:id} = useId();$0" |
| 19 | + "const $1 = useContext($2);$0" |
34 | 20 | ], |
35 | | - "description": "React useId() hook" |
| 21 | + "description": "React useContext() hook" |
36 | 22 | }, |
37 | | - "useSyncExternalStore": { |
38 | | - "prefix": "usesh", |
| 23 | + "useRef": { |
| 24 | + "prefix": "urh", |
39 | 25 | "body": [ |
40 | | - "const ${1:snapshot} = useSyncExternalStore(${2:subscribe}, ${3:getSnapshot}, ${4:getServerSnapshot});$0" |
| 26 | + "const $1 = useRef($2);$0" |
41 | 27 | ], |
42 | | - "description": "React useSyncExternalStore() hook" |
| 28 | + "description": "React useRef() hook" |
43 | 29 | }, |
44 | | - "useActionState": { |
45 | | - "prefix": "uash", |
| 30 | + "useImperativeHandle": { |
| 31 | + "prefix": "uihh", |
46 | 32 | "body": [ |
47 | | - "const [${1:state}, ${2:formAction}, ${3:isPending}] = useActionState(${4:fn}, ${5:initialState});$0" |
| 33 | + "useImperativeHandle(ref, () => {", |
| 34 | + "\treturn {", |
| 35 | + "\t\t$1", |
| 36 | + "\t}", |
| 37 | + "}, [$2]);$0" |
48 | 38 | ], |
49 | | - "description": "React useActionState() hook" |
| 39 | + "description": "React useImperativeHandle() hook" |
50 | 40 | }, |
51 | 41 | "useEffect": { |
52 | 42 | "prefix": "ueh", |
|
78 | 68 | ], |
79 | 69 | "description": "React useInsertionEffect() hook" |
80 | 70 | }, |
81 | | - "useContext": { |
82 | | - "prefix": "uch", |
| 71 | + "useMemo": { |
| 72 | + "prefix": "umh", |
83 | 73 | "body": [ |
84 | | - "const $1 = useContext($2);$0" |
| 74 | + "const ${1:memoizedValue} = useMemo(() => ${2:computeExpensiveValue}(${3:a}, ${4:b}), [${5:a}, ${6:b}]);$0" |
85 | 75 | ], |
86 | | - "description": "React useContext() hook" |
| 76 | + "description": "React useMemo() hook" |
87 | 77 | }, |
88 | 78 | "useCallback": { |
89 | 79 | "prefix": "ucbh", |
|
97 | 87 | ], |
98 | 88 | "description": "React useCallback() hook" |
99 | 89 | }, |
100 | | - "useMemo": { |
101 | | - "prefix": "umh", |
| 90 | + "useTransition": { |
| 91 | + "prefix": "uth", |
102 | 92 | "body": [ |
103 | | - "const ${1:memoizedValue} = useMemo(() => ${2:computeExpensiveValue}(${3:a}, ${4:b}), [${5:a}, ${6:b}]);$0" |
| 93 | + "const [isPending, startTransition] = useTransition();$0" |
104 | 94 | ], |
105 | | - "description": "React useMemo() hook" |
| 95 | + "description": "React useTransition() hook" |
106 | 96 | }, |
107 | | - "import react hooks": { |
108 | | - "prefix": "irh", |
| 97 | + "useDeferredValue": { |
| 98 | + "prefix": "udvh", |
109 | 99 | "body": [ |
110 | | - "import React, { useState, useContext, useEffect, useCallback, useMemo } from 'react';" |
111 | | - ] |
| 100 | + "const ${1:deferredValue} = useDeferredValue(${2:value});$0" |
| 101 | + ], |
| 102 | + "description": "React useDeferredValue() hook" |
112 | 103 | }, |
113 | | - "useRef": { |
114 | | - "prefix": "urh", |
| 104 | + "useDebugValue": { |
| 105 | + "prefix": "udbvh", |
115 | 106 | "body": [ |
116 | | - "const $1 = useRef($2);$0" |
| 107 | + "useDebugValue(${1:value});$0" |
117 | 108 | ], |
118 | | - "description": "React useRef() hook" |
| 109 | + "description": "React useDebugValue() hook" |
119 | 110 | }, |
120 | | - "useImperativeHandle": { |
121 | | - "prefix": "uihh", |
| 111 | + "useId": { |
| 112 | + "prefix": "uidh", |
122 | 113 | "body": [ |
123 | | - "useImperativeHandle(ref, () => {", |
124 | | - "\treturn {", |
125 | | - "\t\t$1", |
126 | | - "\t}", |
127 | | - "}, [$2]);$0" |
| 114 | + "const ${1:id} = useId();$0" |
128 | 115 | ], |
129 | | - "description": "React useImperativeHandle() hook" |
| 116 | + "description": "React useId() hook" |
130 | 117 | }, |
131 | | - "useReducer": { |
132 | | - "prefix": "urdh", |
| 118 | + "useSyncExternalStore": { |
| 119 | + "prefix": "usesh", |
133 | 120 | "body": [ |
134 | | - "const [${1:state},${2: dispatch}] = useReducer(${3:reducer}, ${4:initialArg}, ${5:init});" |
| 121 | + "const ${1:snapshot} = useSyncExternalStore(${2:subscribe}, ${3:getSnapshot}, ${4:getServerSnapshot});$0" |
135 | 122 | ], |
136 | | - "description": "React useReducer() hook" |
| 123 | + "description": "React useSyncExternalStore() hook" |
| 124 | + }, |
| 125 | + "useActionState": { |
| 126 | + "prefix": "uash", |
| 127 | + "body": [ |
| 128 | + "const [${1:state}, ${2:formAction}, ${3:isPending}] = useActionState(${4:fn}, ${5:initialState});$0" |
| 129 | + ], |
| 130 | + "description": "React useActionState() hook" |
137 | 131 | } |
138 | 132 | } |
0 commit comments