This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-03
Channels
- # beginners (446)
- # boot (16)
- # cljs-dev (2)
- # cljsrn (30)
- # clojars (2)
- # clojure (143)
- # clojure-finland (1)
- # clojure-greece (1)
- # clojure-nl (1)
- # clojure-russia (2)
- # clojure-spec (20)
- # clojure-uk (7)
- # clojurescript (167)
- # code-reviews (1)
- # community-development (12)
- # core-async (27)
- # cursive (3)
- # data-science (9)
- # datascript (2)
- # emacs (1)
- # graphql (46)
- # immutant (5)
- # jobs (2)
- # leiningen (1)
- # luminus (1)
- # lumo (76)
- # off-topic (79)
- # perun (2)
- # protorepl (33)
- # re-frame (21)
- # reagent (62)
- # ring-swagger (1)
- # rum (18)
- # spacemacs (6)
- # specter (4)
- # test-check (4)
- # unrepl (9)
- # untangled (2)
- # vim (4)
- # yada (1)
I'm trying to add react-with-addons
, so I can use ReactCSSTransitionGroup as mentioned in this example: https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/ReactCSSTransitionGroup
However, when I load my app, I get util.cljs:11Uncaught Error: js/React is missing
in my browser console.
My project.clj
has the following in the :dependencies
vector:
[reagent "0.6.0-rc" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]
[cljsjs/react-with-addons "15.4.2-2"]
[cljsjs/react-dom-server "15.1.0-0"]
What am I doing wrong?@reefersleep that should work
it could be stale build files (try a different browser, lein clean
)
or it could be load ordering
to debug, open the page in chrome and see if window.React is set in the devtools
@pesterhazy the above was witnessed in Chrome. On your advice, I tried Firefox, this shows the "ClojureScript has not been compiled!" page, but without the util.cljs:11Uncaught Error: js/React is missing
error in the console
I suspect it's the same problem, though
I've lein clean
ed multiple times
window.React
returns undefined
in the chrome console
Guess I'll try and look for additional stale assets
If you are seeing a message like clojurescript has not been compiled
then you likely need to run something like lein figwheel
to compile cljs again after the clean
Also, i wouldnt recommend using different versions of react-with-addons and react-dom-server
Every time I change something, I do lein clean
, lein figwheel
the browser connets to my figwheel repl
I'll try using the same addons and dom-server versions
@reefersleep Also, depending on which version you go with: https://github.com/reagent-project/reagent/issues/290
@reefersleep are you require cljsjs/react-with-addons somewhere in your project?
I mean (:require [cljsjs.react])
I guess so, if you're using reagent?
No, not directly
oh wait
I think there's a caching/tooling problem here, not necessarily a project.clj problem
... leme try something
I'd try to get it to work in firefox (which has a fresh browser cache)
Currently, my project.clj is:
[reagent "0.6.0-rc" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]
[cljsjs/react-with-addons "15.5.4-0"]
[cljsjs/react-dom-server "15.5.4-0" :exclusions [cljsjs/react]]
[cljsjs/react-dom "15.5.4-0" :exclusions [cljsjs/react]]
Same error.
With lein clean
and lein figwheel
, and mv
'ing my project/public/js
. Wonder if there are other assets somewhere.
@reefersleep please see issue i linked
And using Firefox makes no difference.
I'll do that
do you see "ClojureScript has not been compiled" ?
yes, in both browsers @pesterhazy
well then your problem is actually not React, but your figwheel setup
you could try starting a new lein new figwheel
and check the diff
its possible its an early runtime error (because of the react issue) and so see the default 'clojurescript has not been compiled' page
It worked just fine before I added the react-with-addons dependency, though, @pesterhazy - I've been working on this project on and off for half a year 🙂
hah, ok
I'd try if that's really the only change you made
But my experience tells me that you might as well be right, sometimes things get messed up. 🙂
if you can reliably break it by changing that dep
oh wait, there's a reason it displays the error
sorry I didn't say this earlier
According to the example for using transition groups, I've added the following lines to my core.cljs
:
(def css-transition-group
(r/adapt-react-class js/React.addons.CSSTransitionGroup))
And the error actually occurs at the js/React call
since it is undefined
ah so that's it
But the problem is really the same, react
is not being loaded as a dependency. It's as if the react-with-addons
dependency does not contain react itself.
try deferring loading this
to defer, use [:> js/React.addons.CSSTransitionGroup]
instead
are you 100% sure that window.React is not visible in the firefox console after loading the page?
yup, it's undefined
where do I put [:> js/React.addons.CSSTransitionGroup]
?
I tried commenting out the call to `js/React, by the way, but of course react is called elsewhere, so I get the exact same error
Also, by the way, this issue mentions making empty namespaces for cljsjs.react
and cljsjs.react.dom
, which I have also done: https://github.com/reagent-project/reagent/issues/275
reefersleep: I'm not sure what you are trying, but you should NOT create these empty namespaces if you use cljsjs
packages. This is only for those providing React in some other way.
Thank you both for your help. I'm going to keep at it. Wonder if I could do something to clean my .m2
Also, I'll follow your advice and try to reproduce the problem with a minimal example
I tried lein new reagent-frontend foo
and adding the same dependencies, and foo
displays the default page without a hitch.
So I guess it's either some cache problem with my main project or a project.clj
problem... or a code problem.
Even if I include [cljsjs/react "15.4.1-0"]
in my dependencies, react is missing. Weird.
reefersleep: I'm not sure what you are trying, but you should NOT create these empty namespaces if you use cljsjs
packages. This is only for those providing React in some other way.