Fork me on GitHub
#reagent
<
2021-06-28
>
arielalexi14:06:53

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 empty

sansarip14:06:22

That 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:

sansarip14:06:05

Sorry if this is a silly question, but you are attempting this (requiring reagent.core) from a cljs namespace/cljs REPL, right?

Lu14:06:45

If you can link the repo it’s much easier to see what the problem is. Especially since you just started :)

p-himik15:06:26

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.

p-himik16:06:24

Alright. And how exactly are you trying to compile/run the code?

p-himik16:06:16

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

cyppan15:06:01

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) ?

cyppan15:06:49

Thanks! I have to dive into the code, not that easy 😅