title: How to add onclick event to a string rendered by dangerouslysetInnerHtml in reactjs?
body: <p>I have a string , i.e,</p>
  
  <pre><code>let string= "Hello &lt;b&gt;Click here&lt;/b&gt;";
  
  render() {
  return (&lt;div dangerouslySetInnerHTML={this.createMarkup(value)}/&gt;
  }
  
  createMarkup = value =&gt; { 
          return { __html: value };
   };
  </code></pre>
  
  <p>What I would like is to be able to add an onclick event to the <code>&lt;b&gt;</code> tag perform state manipulations on click.</p>
  
  <p>The underlying problem is where I had a function which was supposed to render whatever is passed by the API. The API would send a string 'Money received for order ID <b>123</b>', or could be any string that I have no control over. Later, I got a requirement where the item that is bolded must be clickable, so as to perform some actions. I didn't have any other way to solve it.</p>
  
  <p>How can I achieve this?</p>