Fork me on GitHub
#clojurescript
<
2023-02-18
>
tstout00:02:23

Any recommendations for a clojurescript project template based on tools.deps rather than leiningen?

hifumi12303:02:20

I think the least painful option would be making an up-to-date template in the spirit of npx create-cljs-app. I always find deps.edn and leiningen to be hindrances and mostly unnecessary when I use shadow-cljs

slk50011:02:15

After invoking the 'show' function I'm making an api call & update 'music-video-state' atom. But it doesn't rerender component after receiving the data from api call. What's wrong here? (defonce music-video-state (atom {:youtube-id "" :tags []})) (defn get-music-video-tag-list [music-video-state youtube-id] (ajax/GET (str "" youtube-id "/tags") {:handler #(swap! music-video-state assoc :tags (:data %)) :response-format :json :keywords? true})) (defn show [youtube-id] (api/get-music-video-tag-list music-video-state youtube-id) (let [tags (:tags @music-video-state)] [:div "hello" [:ul (for [tag tags] [:li (:tag_name tag)])]]))

p-himik11:02:36

If it's Reagent, then #C0620C0C8 would be more suitable. You have to use reagent.core/atom instead of cljs.core/atom.

p-himik11:02:28

Also note that a proper way to do it would be to use a form-3 component with the request happening in its :component-did-mount lifecycle function. Otherwise, you'll issue more API requests than you have to, potentially getting stuck in an infinite loop of requests.

slk50011:02:08

good point reagent.core/atom

slk50011:02:51

:component-did-mount thx I will try with that 😄

slk50011:02:55

yep that was the culprit I mistaken atom with reagent/atom

👍 2