bluewings/pug-as-jsx-loader

How to define handlers

Closed this issue · 2 comments

Hi, i have some troubles figuring out what the suggested syntax for eventhandlers would be?

was a mixup on my side never mind :) can be closed

@AirBorne04
Hi, I've added two examples that use event handlers.
One is simple usage and the other is binding arguments to the handler.

You can checkout the examples/create-react-app and run it.

Please let me know if there is a problem.

button(type='button', onClick='{this.handleClick}') click me!
ul
li(@for='(name, i) in characters')
| {name}
button(type='button',
onClick='{this.handleRemove.bind(this, name, i)}') check

For me this was not working that way i had to skip the ' and { and just put the plain function reference, but that might be the case due to my specific setup.