react-jsx-parser icon indicating copy to clipboard operation
react-jsx-parser copied to clipboard

Event hadler is not working

Open Ghoral opened this issue 2 years ago • 1 comments

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.

Ghoral avatar May 31 '22 16:05 Ghoral

Same for me, is it supposed to work that way ?

AstralBaby avatar Jul 05 '22 01:07 AstralBaby

Me too. it just broken. and probably this library is not longer maintained..... nice....

robert8888 avatar Oct 25 '22 13:10 robert8888

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.

robert8888 avatar Oct 28 '22 19:10 robert8888