title: clojurescript + reagent issue
body: <p>I am working on a simple web-app using clojurescript and reagent. I would like to create a simple "tab" component, which will contain (for starters) a text-input component.</p>
  
  <p>The app has 2 tabs and the user has the option to choose a tab and I want to "preserve" the values in each of these two tabs.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>(defn atom-input [value]
    [:input {:type "text"
             :value @value
             :on-change #(reset! value (-&gt; % .-target .-value))}])
  
  (defn simple-tab [index]
    (let [pg-index (atom 1)
          a (atom 0)]
      (fn []
      [:div
       [:h4 (str "index: " @index)]
       [atom-input a]])))
  
  (defn main-page []
    (let [index (atom 0)]
      [:div.container
       [:div.row
        [:button {:on-click (fn [] (reset! index 0))} "select tab 1"]
        [:button {:on-click (fn [] (reset! index 1))} "select tab 2"]]
       [:div.row
        [simple-tab index]]]))
  
  (defn ^:export run []
    (reagent/render-component
     (fn [] [main-page])
     (.-body js/document)))
  </code></pre>
  
  <p>The problem is that when I switch the tab, the components share the values of the input field - what am I please doing wrong here?</p>
  
  <p>Thank you so much for your help!</p>