jsx-to-string
jsx-to-string copied to clipboard
Attaching or binding a function on the "onClick" event has an error.
I just followed the example and somehow created my own based on the example. This is how the parsed look like https://screencast.com/t/pCDuO0lb
Basically, onclick-"{function}..."
is not gonna work.
can you add here the call you are making to the jsx-to-string?
@alansouzati
It is something like this jsxToString(<div> <input name="selected-style" type="checkbox" onClick={self.checkBoxHandler}/></div>)
and checkBoxHandler
is just doing a console log.
checkBoxHandler() { console.log('@checkBoxHandler') }
if you are not sending any parameters I would expect all functions to be onClick={...}
, this is the default behavior.
You can try to tinker with useFunctionCode
and functionNameOnly
to get a different results.
I'm not sure where this onclick-"{function}..."
is coming from.
By default I set {...}
because it is pretty hard (if not impossible) to grab the function code, specially for binded functions.
hey @belmer any update here?