title: how to write inline js event handler code in the react component using "this"
body: <p>I have a html code which I get to re-write in jsx</p>
  
  <pre><code>&lt;div id="parent"&gt;                      
      &lt;div id="child" onclick="this.parentElement.style.background = 'orange';"&gt;                          
          &lt;img src="img/img2.png"&gt;&lt;/img&gt;
      &lt;/div&gt;
  &lt;/div&gt;;
  </code></pre>
  
  <p>Here, In jsx, <code>this</code> refers react component. However, in the above html code, <code>this</code> refers <code>#child</code>.</p>
  
  <p>Can anyone tell me how to write the onclick code of <code>#child</code> in jsx without writing separate handler function but the same way its been written above.</p>