This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-19
Channels
- # announcements (15)
- # babashka (4)
- # beginners (55)
- # calva (92)
- # cider (70)
- # circleci (1)
- # clj-kondo (136)
- # cljdoc (2)
- # clojars (11)
- # clojure (48)
- # clojure-australia (1)
- # clojure-europe (30)
- # clojure-nl (3)
- # clojure-sweden (2)
- # clojure-uk (7)
- # clojurescript (40)
- # conjure (5)
- # core-async (11)
- # cursive (55)
- # data-science (1)
- # datomic (10)
- # degree9 (2)
- # development-containers (15)
- # events (1)
- # fulcro (14)
- # gratitude (13)
- # helix (5)
- # lsp (35)
- # malli (10)
- # meander (18)
- # off-topic (24)
- # pathom (13)
- # polylith (12)
- # practicalli (6)
- # re-frame (13)
- # reagent (33)
- # reitit (4)
- # remote-jobs (1)
- # shadow-cljs (13)
- # spacemacs (31)
- # specter (1)
- # stepwise (2)
- # tools-deps (19)
- # vim (1)
- # xtdb (7)
Hi I am curious to know if anyone has used reagent r/atoms from javascript react component? If so were there any caveats? If not why not?
The need to potentially start porting an existing app to start using a clojurescript core
they work with the "reagent render loop" where you produce hiccup and then convert that to react at the very end - if you got a handle to a reagent atom in a normal react component it wouldn't work
what you can do is pass the current value and a function that will swap the current value down
Hmmm, because I was looking into replacing recoil which basically works like atoms but in a react setting
function YourReactComponent({ value, swapValue }) {
<button onClick={() => { swapValue(v => v + 1); }> {value} </button>
}
(defn your-reagent-component
[]
(let [value-atom (r/atom 0)]
[:> YourReactComponent {:value @value-atom :swapValue #(swap! value-atom %)}]))
I see, not the path of replacement i was thinking of, which was to make a clojurescript library imported into the javascript code
Hey all, trying to use primereact with re-frame and reagent and getting a little hung up.. I think I've got the import right, but I'm getting an error trying to use the adapter.
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Then in browser console I can see the object in module$node_modules$primereact$button$button_cjs
A side-note using parentheses instead of brackets in the :require
vector is generally discouraged. But it's not that important.
If (js/console.log button)
does log a button component then that error comes from some different place, because it's about undefined
.
Alternatively, that button
component itself requires some argument that has to provide a string/class/function. But that argument is not checked explicitly in button
, and you don't provide the value.
Because if not, MUI has definitely quirks on its own that you might encounter sooner or later.
I've used it in angular, so if they are the design system quirks I've probably hit them all
@U2FRKM4TW you've created a monster, already wrapped a few of the PrimeReact components in nicer cljs fns and added some icons from another react component library altogether 🙂