cljss
cljss copied to clipboard
cljss.reagent: React is not defined
Observed Behavior
Hello I'm using Luminus template for shadow-cljs, and I'm trying to use cljss.reagent
(ns tartataing.core
(:require
...
[cljss.reagent :refer-macros [defstyled]]
...)
(:require-macros [cljss.core])
(:import goog.History))
This produce these erros
app.js:1673 ReferenceError: React is not defined
at G__54946 (core.cljs:23)
at cmp.G__52675__delegate (core.cljs:129)
at cmp.tartataing.core.Kikoo [as reagentRender] (core.cljs:119)
at eval (component.cljs:108)
Error rendering component (in tartataing.core.Kikoo)
The above error occurred in the <tartataing.core.Kikoo> component:
in tartataing.core.Kikoo (created by navbar)
Is there something I did wrong ?
Expected behavior
Being able to render red title [:h1]
.
I have the same problem.
Same error here.
I encountered this as well it looks as though the macro eventually expands to a raw call of js/React
(require '[react :as React])
(set! (.. js/window -React) React)
was a quick fix hack in my case.
It seems as though the macro should avoid expanding to js/React.createElement
and instead expand to reagent.core/create-element
which is a wrapper around Reacts createElement func.