React onClick event on component

Posted by Editorial Staff | Updated on

In this answer, We have shared 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:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers