Closed vezwork closed 8 months ago
I get the following error when I define a component and tried to calculate the width of a Rect in that component using the length of props.children.
Rect
props.children
Error useError must be used within an ErrorContext.Provider
Here is a link to codesandbox with the error: https://codesandbox.io/p/sandbox/bluefish-qc-text-forked-tg7lk9?file=/App.js.
The the relevent code is:
const Wire = withBluefish((props) => { const c = children(() => props.children); return ( // ... <Rect height={3} width={(c().length ?? 1) * 60 + 30} fill="black"></Rect> // ...
As a result of this error, I cannot use the length of props.children in a calculation.
Marking this as won't fix for the time being, since I'm not sure how to resolve props.children outside its correct parent context.
I get the following error when I define a component and tried to calculate the width of a
Rect
in that component using the length ofprops.children
.Here is a link to codesandbox with the error: https://codesandbox.io/p/sandbox/bluefish-qc-text-forked-tg7lk9?file=/App.js.
The the relevent code is:
As a result of this error, I cannot use the length of props.children in a calculation.