I have some code that defines a Tabs component like tab-list. I am using it like this:
<tab-list>
<div data-key="mouse" title="Mouse">
<DemoContent />
</div>
<div data-key="keyboard" title="Keyboard">Keyboard Settings</div>
<div data-key="gamepad" title="Gamepad">Gamepad Settings</div>
</tab-list>
function DemoContent() {
return (
<div>
<h2>Sample title</h2>
<button onClick={() => alert()}>Submit</button>
</div>
)
}
This does not work because the children passed to the Tabs component is just an empty element without any props or children.
However, if I you the children inside a slot, they slot is a node with the correct children and props BUT the event listeners don't fire. So this renders the static content, but it is not interactive.
- Can we avoid using the slot and parse any children correctly?
- How can we get the event listeners for nested components to work?
I have some code that defines a
Tabscomponent liketab-list. I am using it like this:This does not work because the children passed to the
Tabscomponent is just an empty element without any props or children.However, if I you the children inside a slot, they slot is a node with the correct children and props BUT the event listeners don't fire. So this renders the static content, but it is not interactive.