Hi, I'm trying to create my first reagent project (and my first cljs project) and can't get past the first render.
I get this error in the console soon as the page loads:
TypeError: module$node_modules$react_dom$index.render is not a function. (In 'module$node_modules$react_dom$index.render((comp.cljs$core$IFn$_invoke$arity$0 ? comp.cljs$core$IFn$_invoke$arity$0() : comp.call(null, )),container,(function (){
var _STAR_always_update_STAR__orig_val__12192 = reagent.impl.util._STAR_always_update_STAR_;
var _STAR_always_update_STAR__temp_val__12193 = false;
(reagent.impl.util._STAR_always_update_STAR_ = _STAR_always_update_STAR__temp_val__12193);
try{cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(reagent.dom.roots,cljs.core.assoc,container,comp);
reagent.impl.batching.flush_after_render();
if((!((callback == null)))){
return (callback.cljs$core$IFn$_invoke$arity$0 ? callback.cljs$core$IFn$_invoke$arity$0() : callback.call(null, ));
} else {
return null;
}
}finally {(reagent.impl.util._STAR_always_update_STAR_ = _STAR_always_update_STAR__orig_val__12192);
}}))', 'module$node_modules$react_dom$index.render' is undefined)
First I followed the shadow-cljs quickstart in its readme:
npx create-cljs-project books-reagent3
and then created app.cljs, index.html and updated shadow-cljs.edn as per the readme. That worked.
Then from the reagent readme I just added reagent to shadow-cljs.edn
dependencies and npm installed react and react-dom. Its using react version 19,
and I put the latest reagent version 1.2.0.
Also from the reagent readme I just added this sample code. I also tried rendering to the "app" div
(ns http://inwalkeddub.frontend.app
(:require [reagent.core :as r]
[reagent.dom :as rd]))
(defn child [name]
[:p "Hi, I am " name])
(defn childcaller []
[child "Foo Bar"])
(defn mountit []
(rd/render [childcaller]
(.-body js/document)))
(defn init []
(println "Hello World")
(mountit))
Don't use React 19.
Thank you. React 18 works.