title: Attaching event handlers to html in ClojureScript / Reagent
body: <p>I'm working on a simple "wiki-like" hypertext view in ClojureScript / Reagent.</p>
  
  <p>I have some text. I now want to turn things that match the LinkPattern into clickable links. </p>
  
  <p>In "traditional" wiki programming, I'd just use regexes to substitute the pattern for a URL. </p>
  
  <p>Eg. turn </p>
  
  <p><code>this is SomeText that's a link</code></p>
  
  <p>into</p>
  
  <p><code>this is &lt;a href="/view/SomeText"&gt;SomeText&lt;/a&gt; that's a link</code></p>
  
  <p>But in this version, </p>
  
  <p>a) I don't want to make them normal html anchor links, I want to attach some kind of on-click event-handler to the links (which will trigger an Ajax call to the server, not reload the whole page)</p>
  
  <p>b) I'm working in Clojure's Reagent wrapper for React. So I'm assuming I don't want to be simply kludging raw Javascript into the html. I want to be attaching the event-handlers in a "principled" way that's right for both ClojureScript and React / Reagent.</p>
  
  <p>So how should I do that? </p>
  
  <p>FYI, I'm pre-processing the markup into HTML and then using :dangerouslySetInnerHTML to insert it into the page. So whatever I do to add the click handler to the links needs to survive that. </p>
  
  <p>Or do I have to add the event handlers <em>after</em> I've rendered them? </p>
  
  <p>In which case, how should I do that? I know what I'd do in JQuery, use "bind" to attach the event handler to spans of a particular class. But again, I'm confused by the right way to think about this in ClojureScript Reagent. What's the equivalent of jQuery's "bind" in that world?</p>