Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cljss.reagent: React is not defined #65

Open
vnctaing opened this issue Oct 18, 2020 · 4 comments
Open

cljss.reagent: React is not defined #65

vnctaing opened this issue Oct 18, 2020 · 4 comments

Comments

@vnctaing
Copy link

vnctaing commented Oct 18, 2020

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].

@carina-akaia
Copy link

I have the same problem.

@rosenjcb
Copy link

Same error here.

@parlir
Copy link

parlir commented Jun 4, 2021

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.

@parlir
Copy link

parlir commented Jun 4, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants