-
Hi, all! debug.module.js:1 Uncaught TypeError: Cannot destructure property 'children' of 'undefined' as it is undefined.
at Object.SpringContext [as __c] (index.js:1349)
at g (hooks.module.js:1)
at Array.forEach (<anonymous>)
at preact__WEBPACK_IMPORTED_MODULE_0__.options.unmount (hooks.module.js:1)
at Object.preact__WEBPACK_IMPORTED_MODULE_1__.options.unmount (compat.module.js:1)
at L (preact.module.js:1)
at L (preact.module.js:1)
at L (preact.module.js:1)
at L (preact.module.js:1)
at L (preact.module.js:1) Currently i'm using the "useSpring" hook, for a few components being called in some state updates.. mainComponent.jsx const main = () => {
.
. some custom logic for my scroll actions....
.
const shouldMount = scrollIndex === 50 ? true : false
return ( <> { shouldMount && <ChildComponent />} </>)
} ChildComponent.jsx const childComponent = () => {
const [case, setCase] = React.useState(0);
const [betValues_filled_3, betValues_filled_3_API] = useSpring(() => ({
opacity: 0,
transform: "scale(1)"
}));
switch(case) {
case 0: {
betValues_filled_3_API.start({
opacity: 1,
transform: "scale(1.2)",
delay: 2000
})
break
}
case 1: {...}
case 2: {...}
case 3: {...}
}
return (
<>
<animated.div style={{...someCustomsStyles, ...betValues_filled_3}} >
.
. Some custom components....
.
</animated.div>
</>
)
} any ideas or suggestions would be greatly appreciated, thank you! 😓😓 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
const [betValues_filled_3, betValues_filled_3_API] = useSpring(() => ({
opacity: 0,
scale: 1
})); And when passing it to the |
Beta Was this translation helpful? Give feedback.
-
I have the same issue, though with useTransition. Did you manage to figure it out? |
Beta Was this translation helpful? Give feedback.
-
This will be fixed in the next version of Preact (10.5.14). If you're waiting for that, here's a patch you can drop anywhere into your project that fixes the issue in Preact 10+: import { options } from 'preact';
let old = options.__h;
options.__h = (c, i, type) => {
if (type === 9) {
let hooks = c && (c.__H || (c.__H = { __: [], __h: [] })) && c.__H.__;
if (!hooks[i]) hooks[i] = Object.defineProperty({}, '__c', DESC);
}
if (old) old(c, i, type);
};
const DESC = {
get() { return this.c },
set(v) { this.c = typeof v === 'function' ? Object.assign({}, v) : v },
}; |
Beta Was this translation helpful? Give feedback.
This will be fixed in the next version of Preact (10.5.14). If you're waiting for that, here's a patch you can drop anywhere into your project that fixes the issue in Preact 10+: