title: How to use `setTimeout` in ClojureScript?
body: <p>I'm trying to make a sleep function in ClojureScript (w/ Reagent):</p>
  
  
  
  <pre class="lang-clj prettyprint-override"><code>(ns cljweb.webpage
    (:require [reagent.core :as reagent]))
  
  (def temp-atom (reagent/atom 0))
  
  (defn sleep [msec]
    (js/setTimeout (fn []) msec)) 
  
  (defn page []
    [:div
     [:p @temp-atom]
     [:button
      {:on-click
        (fn []
          (sleep 3000) 
          (swap! temp-atom inc))}
      "Click me!"]])
  </code></pre>
  
  <p>For some reason, this doesn't sleep properly - when I click the "Click me!" button, <code>temp-atom</code> increments instantly - when I time it, by putting this after in <code>page</code>:</p>
  
  <pre class="lang-clj prettyprint-override"><code>[:p (time (sleep 3000))]
  </code></pre>
  
  <p>I get this in the console:</p>
  
  <pre class="lang-clj prettyprint-override"><code>"Elapsed time: 0.015000 msecs"
  </code></pre>
  
  <p>What did I do wrong in the code?</p>