I would like to get started experimenting with a fullstack clojure/clojureScript application.
To learn to understand the basic structure I’d like to use the most basic tooling, no lein, no figwheel, no boot, no luminus. Only Clojure (+ring +reitit +rum) and ClojureScript (+rum +shadow-cljs)
What I try to get going is the following:
a Clojure Server that serves a serverside (pre-)rendered rum component that gets fully hydrated from cljs
all of that with that “great dynamic clojurey workflow” (instant live reloading)
It is still not working. The first render with Shadow-Cljs works but when the file gets saved, shadow-cljs reloads and reexecutes the file and then the result is:
45 | (rum/defc item [data]
46 | [:div.item
47 | [:div.picture (picture "https://t1p.de/adga")]
48 | [:div.title (:title data)]])
------------------------------^-------------------------------------------------
Use of undeclared Var projectname.core/data
--------------------------------------------------------------------------------
All I do, is the following in src/cljs/projectname.cljs:
FWIW I just tested this and it is working completely fine without any warnings?
(ns projectname.core
(:require [rum.core :as rum]))
(defonce app-state (atom {:text "Hello world!"}))
(rum/defc hello-world [data]
[:div
[:h1 (:text @app-state)]
[:h3 "Edit this and watch it change!" (:foo data)]])
(defn start []
;; start is called by init and after code reloading finishes
;; this is controlled by the :after-load in the config
(rum/mount (hello-world {:foo "bar"})
(. js/document (getElementById "app"))))
(defn ^:export init []
;; init is called ONCE when the page loads
;; this is called in the index.html and must be exported
;; so it is available even in :advanced release builds
(start))
(defn stop []
;; stop is called before any code is reloaded
;; this is controlled by :before-load in the config
(js/console.log "stop"))
with
:dependencies [[binaryage/devtools "0.9.7"]
[rum "0.12.4"]
;; fork to support react 16
;; [ua.modnakasta/rum "0.11.0-2"]
[org.roman01la/citrus "3.0.0" :exclusions [rum]]
]
running shadow-cljs watch app and http://localhost:8700/.
I am beginning to question my sanity xD.
I copy pasted the code you just quoted here and it WORKED!
I did copy it from the state where it didnt!!
maybe I am just not seeing right, and there is an obvious typo somewhere, if that is the case, I feel really sorry