web-react-components
web-react-components copied to clipboard
Emitted event from the child cannot be caught
I have been trying to follow the instructions. Currently I have something like this
export default function SimpleComp(props) {
let name = props.name;
const onButtonClick = props.onButtonClick;
return (
<div>
hello all, the name is {name}
<button onClick={onButtonClick}>Click this</button>
</div>
);
}
register(SimpleComp, 'simple-component', [
'name'
],
{
onButtonClick: e => {
console.log(e)
e.stopPropagation();
return new Event('clickbutton', { bubbles: true })
}
}
)
Now in my app.js I use it like this
<simple-component name='webcomponent' onButtonClick="console.log('attribute callback 'onclickbutton' triggered', this)"> </simple-component>
The component shows up fine but when trying to emit an event the eventemitter on the register function works but the function on the parent does not run.
I have the same bug, can't catch mouseenter/mouseleave events in react components, which wraps my "web-react-components"