Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attaching or binding a function on the "onClick" event has an error. #20

Open
belmer opened this issue Feb 15, 2017 · 4 comments
Open

Comments

@belmer
Copy link

belmer commented Feb 15, 2017

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.

@alansouzati
Copy link
Collaborator

can you add here the call you are making to the jsx-to-string?

@belmer
Copy link
Author

belmer commented Feb 16, 2017

@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') }

@alansouzati
Copy link
Collaborator

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.

@alansouzati
Copy link
Collaborator

hey @belmer any update here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants