This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-20
Channels
- # aleph (19)
- # aws-lambda (8)
- # bangalore-clj (1)
- # beginners (13)
- # boot (179)
- # cljs-dev (12)
- # cljsjs (2)
- # cljsrn (6)
- # clojure (174)
- # clojure-italy (14)
- # clojure-nl (2)
- # clojure-russia (172)
- # clojure-spec (29)
- # clojure-uk (22)
- # clojurebridge (10)
- # clojureremote (1)
- # clojurescript (79)
- # cursive (46)
- # data-science (1)
- # datascript (8)
- # datomic (18)
- # defnpodcast (2)
- # emacs (9)
- # events (6)
- # hoplon (11)
- # klipse (13)
- # lein-figwheel (1)
- # leiningen (1)
- # luminus (1)
- # lumo (88)
- # numerical-computing (1)
- # off-topic (24)
- # om (33)
- # onyx (58)
- # protorepl (8)
- # re-frame (10)
- # reagent (26)
- # ring (8)
- # ring-swagger (7)
- # rum (22)
- # spacemacs (25)
- # specter (5)
- # uncomplicate (37)
- # untangled (75)
- # vim (17)
- # yada (3)
We don't seem to be able to do (.-offsetWidth (.getElementById js/document "foo"))
in a reagent component. We keep getting sth like react.inc.js:7864 Uncaught TypeError: Cannot read property '__reactInternalInstance$izyiy1nbjzhmku0kvbb0m5cdi' of null
Quick look at our code and we do something like this (.-offsetWidth (aget (.-childNodes (reagent/dom-node this)) 0)))
Could be that you don't want the childNodes, but I'm guessing you need to use (dom-node this)
, not getElementById
@stammi my guess is that this has nothing to do with react
unless "#foo" is a react component?
in which case you should use a "callback ref" to access the comp, not getElementById
thanks @kauko and @pesterhazy . Our problem was calling that code in the render fn, so it was called before the stuff was actually rendered
glad it works for you but it's still not the recommended way to access DOM elements in a React app
by definition, the render fn will be called before the component is mounted, i.e. before the dom node is created
to access attributes of the dom node, it's better to use component-did-mount or a ref callback, both of which are guaranteed to be called only once the component is mounted
This seemed to work:
[reagent "0.6.0" :exclusions [cljsjs/react]]
[cljsjs/react-with-addons "15.4.2-2"]
This:
[reagent "0.6.0" :exclusions [cljsjs/react]]
[cljsjs/react-with-addons “15.4.2-2”]
gives me:
js/ReactDOM is missingWith global exclusions and explicitly depending on react-dom and react-dom-server it works
Guys, I need help. I have to implement a dashboard. But, I wanna use clojure/clojurescript for this. I have a template for this job. But I couldn’t make it work. I have translated html to hiccup, but template-in jquery functions doesn’t work. What have I missed ? Template I tried to implement: https://github.com/puikinsh/gentelella Thanks for your help from now.
> Gentelella Admin is a free to use Bootstrap admin template. This template uses the default Bootstrap 3 styles along with a variety of powerful jQuery plugins and tools to create a powerful framework for creating admin panels or back-end dashboards.
this is a red flag - react and jQuery plugins generally don't mix well
unless you want to use it without react?
I find it near impossible to help you without code samples @scknkkrer