This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-26
Channels
- # announcements (6)
- # beginners (88)
- # calva (12)
- # cider (13)
- # cljs-dev (27)
- # cljsrn (2)
- # clojure (68)
- # clojure-argentina (2)
- # clojure-dev (10)
- # clojure-europe (1)
- # clojure-greece (1)
- # clojure-italy (5)
- # clojure-nl (15)
- # clojure-spec (33)
- # clojure-switzerland (1)
- # clojure-uk (10)
- # clojurescript (121)
- # clojutre (3)
- # code-reviews (2)
- # core-async (1)
- # cursive (10)
- # data-science (1)
- # datomic (21)
- # emacs (10)
- # events (1)
- # fulcro (25)
- # graphql (6)
- # joker (4)
- # kaocha (12)
- # lambdaisland (3)
- # music (2)
- # off-topic (112)
- # om (2)
- # re-frame (25)
- # reagent (29)
- # reitit (93)
- # rewrite-clj (2)
- # shadow-cljs (18)
- # slack-help (4)
- # spacemacs (8)
- # tools-deps (1)
- # vim (2)
- # yada (5)
how can I access JavaScript's this
from inside a Reagent component? this-as
doesn't seem to give me anything other than the global this
did you try reagent/current-component
?
do you mean the this
specifically or the dom node?
you can always get this with this-as
, to get the dom node you need reagent.dom/dom-node
the way you would use it in a component you'd have to make use of the :ref
key
(defn some-component [data]
(let [dom-node (reagent/atom nil)]
(fn []
[:div
{:ref (when %
(reset! dom-node (reagent.dom/dom-node %)))}])))
something like that
probably easiest way to do it without a form-3 component
Any documentation or blog-post to explain this ? https://clojurians.slack.com/archives/C073DKH9P/p1566832570071000
> If you want to use your own build of React (or React from a CDN), you have to use :exclusions variant of the dependency, and also provide a file named “cljsjs/react.cljs”, containing just (ns cljsjs.react), in your project.
@scknkkrer That comment is out of date. Reagent docs mentions one way (https://github.com/reagent-project/reagent/blob/master/doc/0.8-upgrade.md#browser---webpack) and Shadow-cljs has it's own way: https://shadow-cljs.github.io/docs/UsersGuide.html#js-resolve-global
Actually, I have encountered this error in my compilation; http://reactjs.org/docs/error-decoder.html?invariant=227
I think my forieng-libs
defination is just right.
But, I think I’ve fall for a hidden pitfall. :face_with_rolling_eyes:
That could be due to a lot of things... how are you compiling?
@scknkkrer can you provide a smallest possible example? Like stripped out version of your project where the issue reproduces?
@scknkkrer Did you load just React from CDN? You need to also load React-dom from CDN.
Here is my foreign-libs
defination in my project.clj
file.
[{:file "app/prod/js/bundle.js"
:provides ["react" "react-dom" "create-react-class" "react-dom/server"]
:global-exports {react React
react-dom ReactDOM
create-react-class createReactClass
react-dom/server ReactDOMServer}}]
The advanced
is an option to a closure compiler
https://developers.google.com/closure/compiler/docs/compilation_levels
@jahson, I mean, the internal mechanics of it.
Did you guys know about, did using keyword in case
function to match a value cause bug in other than none
for optimizations
flag ?
@scknkkrer Here, I built this and it is working https://github.com/jahson/cljs-webpack-react-example
Actually, it's unnecessary to write a externs
file for JS
libraries. Most of the compilers support auto infer, such as shadow-cljs
, to learn quickly in:
https://shadow-cljs.github.io/docs/UsersGuide.html#_simplified_externs
Actually, it's unnecessary to write a externs
file for JS
libraries. Most of the compilers support auto infer, such as shadow-cljs
, to learn quickly in:
https://shadow-cljs.github.io/docs/UsersGuide.html#_simplified_externs