News for hackers. Stuff that matters.
Re:15 years trying to make everyone separate HTML, JavaScrip... by bschwindHN on Tuesday December 20, 2016 @12:59AM (#13217814)
I kind of want to show him this code to upset him more. I think React is great, especially when using it through ClojureScript.

  (defn todo-list []
    (let [todos (atom [])
          text (atom "")
          add-todo #(do
                      (swap! todos conj @text)
                      (reset! text ""))]
      (fn []
        [:form {:on-submit add-todo
                :action "javascript:"}
         [:input {:type "text"
                  :value @text
                  :on-change #(reset! text (.-target.value %))}]
         [:button {:type "submit"} "Add"]
         [:ul
          (for [todo @todos]
            ^{:key todo} [:li (str todo "!")])]])))
Re:15 years trying to make everyone separate HTML, JavaScrip... by throwaw12ay on Tuesday December 20, 2016 @06:46AM (#13219018)
It's great that you don't need Clojurescript or even JSX to do that. You can write plain ES5 and get the same result. And it would stay readable for most.