Properties not reactive with dynamic
I have this code (in brief).
Upstream there is a disabled prop. It's not being reactive when used with Dynamic.
However, if I replace Dynamic with Span like:
Then the component that is using Box to be disabled/enabled. Now works.
Is there an alternative for Dynamic that I can use?
Thanks!
10 Replies
What happens if you pass
"span"
as component to Dynamic?
Really, it needs to be Element.
I just wanted to see what would happen if Dynamic was replaced.
Changing it to 'span' works.
Well it works in the way that swapping out Dynamic for span worked. 😂 The component itself is broken completely.
Try to put
local.component || 'div'
directly in the JSXyou mean like:
No inside Dynamic’s component prop
No difference.
Can you reproduce this in the playground?
Unfortunately not. It's a core component of this lib I'm working on. I'm like 99% there. 😅
Just logically:
if it works by using an HMTL element directly or pass just a string to the Dynamic component then there must be something wrong with
local.component
or the component that is passed in.Well, the component is completely broken. If I navigate to other components in the storybook. None of them work.
It only works in the sense that the props are reactive.
Got it working. Had to do some gymnastics 😩
Updating the "context".
and the return
Ok, better. 😮💨