How to modify props of children?
In react i was using CloneElement, how to achieve this in solidjs?
{props.children[0]}
i want to add onclick method to this7 Replies
There’s a thread discussing this.
Short: you don’t. There’s no cloneElement because children are html elements not jsx elements. You can use context, to pass props to children or use the children helper and then manipulate the html elements with native js methods.
Can you provide a specific use case?
https://discord.com/channels/722131463138705510/1258411547701542923
I think idont need this anymore
cuz Ive decided to use <DropdownItem> component for this 🤔

i wanted to make dropdown component
then in the component, attach the onclick prop to the 1st button there
but this is too much work
as i'd have to modify the prop in Effect
so i want to have something like this

If you design your own components just provide a drop-down trigger component to open and close the drop-down.
A good example is
https://kobalte.dev
Exactly 👍
And there’s the dynamic component which you can use if you want to let the user decide which element tag or custom element they want to use.
Dynamic -
Documentation for SolidJS, the signals-powered UI framework