react-jsx-parser
react-jsx-parser copied to clipboard
Event hadler is not working
Hi, I was trying to bind the onClick function using eventhandler but nothing seems to work. Here is my code.
<JsxParser bindings={{ myEventHandler: () => { console.log('evet'); }, }} components={{ InjectableComponent }} jsx={ <h1 {onClick or eventHandler} ={myEventHandler}>Header</h1> <InjectableComponent eventHandler={myEventHandler} truthyProp /> } />
Here both onClick ad eventHandler is not working. Thank you.
Same for me, is it supposed to work that way ?
Me too. it just broken. and probably this library is not longer maintained..... nice....
blacklistedAttrs: [/^on.+/i],
// default: removes `on*` attributes (onClick, onChange, etc.)
// any attribute name which matches any of these RegExps will be omitted entirely
attributes start from "on" are by deflatu ignored. your "onClick" is ignored this is why you can't pass handler.