web-react-components icon indicating copy to clipboard operation
web-react-components copied to clipboard

Event handler conventions and prop clashes

Open ChristophP opened this issue 8 years ago • 2 comments

  1. 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

  1. We should check if props already exist when adding getters and setters, instead of overwriting them.

ChristophP avatar Jun 22 '17 21:06 ChristophP

  1. I thought about this too, but what if you don't prefix your handlers with on in React? We should avoid too much magic. You just use it like you defined it.
  2. We should!

layflags avatar Jun 24 '17 08:06 layflags

Agreed let's drop point one.

ChristophP avatar Aug 09 '17 18:08 ChristophP