web-react-components
web-react-components copied to clipboard
Event handler conventions and prop clashes
- Investigate how event handlers behave when passing event types that aren't lowercase.. Right now we call event handlers like this:
c.addEventListener('onClickButton', function(e) {
console.log('Event `onClickButton` triggered', e)
});
that's not very nice because usually there shouldn't be an on in the first param of addEventListener.
https://developer.mozilla.org/de/docs/Web/API/EventTarget/addEventListener
- We should check if props already exist when adding getters and setters, instead of overwriting them.
- I thought about this too, but what if you don't prefix your handlers with
onin React? We should avoid too much magic. You just use it like you defined it. - We should!
Agreed let's drop point one.