Fork me on GitHub

Say I'm using reagent features like track, cursors to have reactivity (so that functions are re-run when value changes) I'm running into cases where sometimes I want reactivity and sometimes I don't Is there a way I can make the function using track and cursors to be non-reactive? (i.e. evaluated only once when I call it and not evaluated when the value changes)


Also, if there a way to do that but for functions which call functions which in turn have cursors and the like? (i.e. nested case of the question above)

Dustin Paluch04:03:03

the readme says that reagent uses “hiccup-like” markup, but isn’t actually depending on hiccup or a cljs port of it, is it?


No, Reagent has its own implementation.

👍 1
Yosevu Kilonzo05:03:47

Hello, how do I render a react element like this with reagent?

Yosevu Kilonzo13:03:19

Thanks, I tried create-element, but I get this error. The component renders when I put it in JSX so there must something else I am missing.

Yosevu Kilonzo03:03:09

My issue was that I was incorrectly accessing the source component from a JS object.

Mitul Shah20:03:24

Would anyone know how to write the equivalent in Reagent? I’d like to have a prop to render a component as whatever HTML element I’d like

Mitul Shah20:03:37

@UGT1B8S3T are you trying to do same thing?


just a function that you pass the keyword for the element as an argument?

Mitul Shah20:03:14

but also have a default if no keyword is passed


using or in the function?

Mitul Shah20:03:18

in the function right?

Yosevu Kilonzo03:03:38

My issue was with the way I was accessing the source react component.

Yosevu Kilonzo03:03:57

Have you tried to translate it to cljs?

🥲 1
Mitul Shah14:03:52

I wish I knew where to start 😅 Not sure if cljs allows anything similar to as prop still a beginner

oxalorg (Mitesh)11:03:00

@U023KKYKZNE this should work

(defn heading [children & {:keys [as]
                           :or {as :h2}}]
  (js/console.log children as)
  [as children])

(defn main []
   [heading "Hello world in h2"]
   [heading "Hello world in small" :as :small]])

👀 1
🏆 1
Mitul Shah19:03:49

nice!!!! pretty neat. thanks so much