Fork me on GitHub
#reagent
<
2021-09-01
>
Mitul Shah18:09:16

I’m trying to pass through the disabled attribute to a button but can’t seem to get it right HTML <button class="bg-red" disabled>Click</button> CLJS [:button {:class "bg-red" :disabled true} "Click"]

p-himik18:09:44

That looks correct to me.

Drew Verlee21:09:51

I'm getting an error that reagent.core/render (aliased as r below) is depreciated. What should i be using? my minimal setup

(defn root []
  [:h3 "hello world"])

(defn ^:dev/after-load start []
  (r/render [root]
            (.getElementById js/document "app")))

(defn init []
  (start))

p-himik21:09:25

reagent.dom/render.

Drew Verlee21:09:11

Thanks. Huh. Maybe I misread the example I was looking at.

lilactown21:09:18

reagent.core/render was deprecated recently, v1.0.0 i think

lilactown21:09:23

or maybe 1.1

juhoteperi06:09:35

The fn was deprecated already in v0.10.0, v1.0 removed the implementation and added message pointing to the new namespace:

(defn render
  {:deprecated "0.10.0"}
  [& _]
  (throw (js/Error. "Reagent.core/render function was moved to reagent.dom namespace in Reagent v1.0.")))

juhoteperi06:09:34

The runtime error is only shown in browser console. Deprecation is shown during compilation so it isn't obvious to check the browser for reason, but there isn't really better way to communicate this in the library. Changelog mention this.

p-himik06:09:16

https://guide.clojure.style/#superseded-by suggests using :superseded-by along with :deprecated. Not sure whether any tool picks it up though.

p-himik06:09:18

Doesn't seem like CLJS itself uses it.

juhoteperi06:09:04

Interesting! Yeah, I don't think compiler will use this, but maybe some other tool uses it, and no downside to adding that.