Hey everyone, I am trying to work with reagent in my project, and it seems like something is broken.
(ns learn-fe (:require [reagent.core :as r])) => nil
I am working from an empty project and not from a template project.
when I try to user reaget in my code, I am getting the error (below) and when I looked inside reagent ns - I don't see all the function reaget should have.
; Execution error (FileNotFoundException) at learn-fe/eval37225$loading (REPL:1).
; Could not locate Reagent/core__init.class, Reagent/core.clj or Reagent/core.cljc on classpath.
deps.edn is update with the reagent version - reagent/reagent {:mvn/version "1.0.0"}
I would be happy to get some help why the requried dependency is emptyThat screenshot is from the reagent.core clj namespace and contains the with-let
macro definition and looks correct. If you look at the reagent.core cljs namespace it should contain the “missing” functions. It’s hard to say what the issue is without looking at your deps.edn
:thinking_face:
Sorry if this is a silly question, but you are attempting this (requiring reagent.core) from a cljs namespace/cljs REPL, right?
If you can link the repo it’s much easier to see what the problem is. Especially since you just started :)
Hi! I’m currently discovering Reagent and I’m trying to understand how it handles re-rendering under the hood. For instance in the case of a form-2 component with a ratom, how is it translated into React code ? Does it use setState/getState internally (or useState with the new functional compilation) ?
The error: Could not locate Reagent/core__init.class
Notice how it says Reagent
instead of reagent
. Clojure[Script] is case-sensitive, so make sure your :require
vector has the lower-case word.
Class components use forceUpdate
and functions use useState
(https://github.com/reagent-project/reagent/blob/master/src/reagent/impl/component.cljs#L402_L413)
Thanks! I have to dive into the code, not that easy 😅
https://github.com/ArielA147/leran-clojure-script
@p-himik I used reagent
in lower-case letters.
Alright. And how exactly are you trying to compile/run the code?
Issues with that repo:
• No ClojureScript dependency specified
• The only source file uses cebab-case instead of snake-case. In Clojure, if you have a namespace a-b
, then the file has to be named a_b
, followed by an appropriate extension
• clj -M --main cljs.main --compile learn-fe
(the simplest way to build CLJS) fails when evaluating the lambdaisland
require. It works fine if I leave only the Reagent require