onClick in dataFormat() fires without actual 'clicking'
See original GitHub issueI define my TableHeaderColumn
as follows:
<TableHeaderColumn dataField="someData" dataFormat={this.valueFormatter}>Value</TableHeaderColumn>
As the valueFormatter
I have following code:
valueFormatter(cell, row){
return (
<p onClick={console.log('value clicked')}>{cell}</p>
);
}
The table generates without errors but in the console I see value clicked
10x (as much as there are rows).
What I want: The function (in the above example a simple console.log()
) should be called only if I click on the element.
What is wrong with my code, or is there another way to solve this?
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
on("click", event) firing without clicking - javascript
Im trying to use jQuery's on("click") to fire a function that simply changes the class of the id which was clicked. But the...
Read more >chart.events.click | highcharts API Reference
Fires when clicking on the plot background. One parameter, event , is passed to the function, containing common event information. Information on the...
Read more >Element: click event - Web APIs | MDN
click fires after both the mousedown and mouseup events have fired, ... Returns true if the alt key was down when the mouse...
Read more >JavaScript onclick event - javatpoint
The onclick event generally occurs when the user clicks on an element. It allows the programmer to execute a JavaScript's function when an...
Read more >lightning-input - documentation - Salesforce Developers
This event has no default behavior that can be canceled. You can't call preventDefault() on this event. composed, true, This event propagates outside...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should be good for your case,
Hello, Try
It worked for me.