I am doing an Ajax GET from my Reagent application to download some things from the database.
I'm not quite sure what the best way to get the result of such an ajax call to my page, given that if I put it in an atom, Reagent will automatically re-render the component when the atom is dereferenced, which means that I get an endless sequence of ajax calls.
For some code
(def matches (atom nil)) (defn render-matches [ms] (reset! matches (into [:ul] (map (fn [m] ^{:key m}[:li m]) (walk/keywordize-keys (t/read (t/reader :json) ms)))))
This function basically creates [:ul [:li "Stuff here"] [:li "And here"]]
What I would like to display on my page, which now has the following code.
(defn standings-page [] (GET "/list-matches" {:handler render-matches}) @matches)
ajax clojurescript reagent
Helios
source share