-
Notifications
You must be signed in to change notification settings - Fork 17
Add callback for click #12
Comments
good point 🙂 |
Any updates on this issue !? |
HTH meanwhile I'm using
|
People interested in this; Please make a PR, this is a trivial thing that can be added into the library easily. |
Hello all, I'm not sure if I'm doing something wrong or if there is an issue with this implementation. Basically, I'm logging claps to my back-end for analytics purposes, but each clap is getting logged twice. What is strange is that in the below example, console.log only logs once, but alert() will get called twice, with two dialog boxes spawned.
Anyone know how/why? |
Workaround is enclosing the <ClapButton component in a div with an onClick that triggers the function that logs to the backend. Now it only gets called once, and the click handler on the parent / wrapper div doesn't prevent the ClapButton's animations / counting logic from triggering, which is great. But, still curious why onCountChange was getting called twice... |
Hey @danielthedifficult, if you could provide a codesandbox or similar with a repro I'll check it out 👍 |
Sure @breadadams, here you go: Check the code here: See onCountChange function with one alert() and one console log. ''\(O.o)/'' Thanks for the rapid reply to an ancient thread :-) |
Would be ideal to allow users to hook into the
onClick
event, returning them a payload. eg.It'd probably be best to do it "after click", so maybe an
afterClick
prop? That we'd add as the callback to the currentonClick
method'sthis.setState(…
.The text was updated successfully, but these errors were encountered: