Cloning an element using cloneElement
doesn’t pass the props listed
{cloneElement(children, {
className: '123',
['data-sticky']: isStickied ? 'true' : 'false',
})}
Cloning an element using cloneElement
doesn’t pass the props listed
{cloneElement(children, {
className: '123',
['data-sticky']: isStickied ? 'true' : 'false',
})}
Only thing I seem to be able to pass is children
I had been through this issue. Let me check the previous thread.
I think it’s a different context but the fact that Plasmic component that renders the Artboard isn’t the same as normal react component so It might omit certain props.
However, normal props should pass. I had used them in specific code components using cloneElement.
Can you try passing something like
{cloneElement(children, {
className: '123',
isStickied,
})}
Also, one more thing. I have seen that there are some keywords as well. So “true” and “false” variants and number variants like 0,1,2,3 are considered as keywords. It has to be passed with “_” prefix like so
“_true”, “_false”, “_0”, “_1” etc
I saw that thread, it seems like normal props doesn’t work either
Even something like
<PlasmicComponent
component="Component / Header"
componentProps={{
onClick: () => console.log('clicked'),
['testing']: '_123',
}}
/>
wouldn’t work
Hmm. Weird! Maybe a bug.
Btw, shouldn’t it be testing
instead of ['testing']
?
testing
/ 'testing'
/ ['testing']
all behave the same
at this point, it seems like giving into nested divs is the solution
hmm where are you doing cloneElement from? can you paste a little more context?
I wiped my node_modules and next cache and it seems to be working now