This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-11
Channels
- # asami (19)
- # babashka (41)
- # beginners (115)
- # biff (7)
- # calva (78)
- # clj-kondo (29)
- # cljs-dev (9)
- # clojure (39)
- # clojure-europe (17)
- # clojure-gamedev (29)
- # clojure-nl (1)
- # clojure-norway (9)
- # clojure-spec (2)
- # clojure-uk (3)
- # clojurescript (7)
- # core-async (26)
- # cursive (16)
- # datomic (13)
- # emacs (1)
- # events (5)
- # fulcro (2)
- # funcool (4)
- # gratitude (1)
- # helix (1)
- # holy-lambda (1)
- # humbleui (1)
- # introduce-yourself (4)
- # java (1)
- # jobs (2)
- # jobs-discuss (9)
- # lsp (28)
- # matcher-combinators (2)
- # mathematics (1)
- # membrane (1)
- # nbb (12)
- # off-topic (10)
- # pathom (52)
- # polylith (38)
- # portal (32)
- # re-frame (4)
- # reagent (16)
- # reitit (2)
- # remote-jobs (1)
- # reveal (1)
- # rewrite-clj (10)
- # sci (67)
- # shadow-cljs (45)
- # squint (1)
- # tools-build (13)
- # tools-deps (16)
Hi all! I'm getting an error when trying to evaluate the macroexpanded form of defrecord at the repl.
On clojurescript if I (macroexpand '(defrecord ARecord [n]))
and look for the ->ARecord
fn definition it looks like (cljs.core/defn ->ARecord [n] (new cljs.user/ARecord n nil nil nil))
where it calls the ARecord constructor with 4 args (I imagine for meta, extension map, etc) . But if I try to eval that constructor at the repl like this (new cljs.user/ARecord n nil nil nil)
it fails with Wrong number of args (4) passed to cljs.user/ARecord
What am I missing here?
Hi ClojureScriptians! We have a reagent+re-frame application where we want to let content (stuff loaded from the server) get control over the page, add and remove things from the DOM. The application is being ported from a PHP+jquery version, where the content could do this manipulation using javascript/jquery. What would happen if we let jquery loose on a react controlled DOM? Anti-matter forms? If so, is there some way we can give the jquery scripts some handle to the react components enabling peaceful co-existence? I'm also thinking that if we used reagent via scittle maybe that could work better than jquery for the requirement? Please share any ideas around this you might have. 🙏
Yea if you want to have both react and jquery controlling the same dom components, I expect that will cause problems. But are you able to isolate it? It isn't a problem to have other components inside of react. Here is an example from the documentation: https://day8.github.io/re-frame/Using-Stateful-JS-Components/
Or you could do the inverse, mounting react many places in certain DOM nodes instead. But having both libraries modify the same piece of the DOM I don't think will work.
form-3 components is the typical answer, although the dynamically loaded code is an interesting twist
> If so, is there some way we can give the jquery scripts some handle to the react components enabling peaceful co-existence? I have done this before with plain react and a class component. I think you just save the result of 'React.createElement', and that is the component instance you can call methods on. I haven't done it with re-frame, but I guess you could export namespace-level functions from the CLJS side instead.