Quantcast
Viewing all articles
Browse latest Browse all 3

Answer by Bogdan Dumitru for React onClick event on component

This depends on your SensorItem component's definition.Because SensorItem isn't a native DOM element but, like you said, another React component, onClick as defined here is simply a property of that component. What you need to do is, inside of the SensorItem component pass the onClick prop to an DOM component's onClick event:

var SensorItem = React.createClass({  render: function() {    return (<div className="SensorItem" onClick={this.props.onClick}>       ...</div>    );  }});

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>