Skip to content

Commit 39399ec

Browse files
committed
chore: useMemo instead
1 parent bb9dda7 commit 39399ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/CSSMotion.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export function genCSSMotion(config: CSSMotionConfig) {
163163
}
164164

165165
// ====================== Refs ======================
166-
const [refObj] = React.useState<CSSMotionRef>(() => {
166+
const refObj = React.useMemo<CSSMotionRef>(() => {
167167
const obj = {} as CSSMotionRef;
168168
Object.defineProperties(obj, {
169169
nativeElement: {
@@ -178,7 +178,7 @@ export function genCSSMotion(config: CSSMotionConfig) {
178178
},
179179
});
180180
return obj;
181-
});
181+
}, []);
182182

183183
// We lock `deps` here since function return object
184184
// will repeat trigger ref from `refConfig` -> `null` -> `refConfig`

0 commit comments

Comments
 (0)