We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb9dda7 commit 39399ecCopy full SHA for 39399ec
src/CSSMotion.tsx
@@ -163,7 +163,7 @@ export function genCSSMotion(config: CSSMotionConfig) {
163
}
164
165
// ====================== Refs ======================
166
- const [refObj] = React.useState<CSSMotionRef>(() => {
+ const refObj = React.useMemo<CSSMotionRef>(() => {
167
const obj = {} as CSSMotionRef;
168
Object.defineProperties(obj, {
169
nativeElement: {
@@ -178,7 +178,7 @@ export function genCSSMotion(config: CSSMotionConfig) {
178
},
179
});
180
return obj;
181
- });
+ }, []);
182
183
// We lock `deps` here since function return object
184
// will repeat trigger ref from `refConfig` -> `null` -> `refConfig`
0 commit comments