I am just getting started with learning ClojureScript and am baffled by a number of things, mainly to do with the dev environment. I'd really like to get cracking building a web page but am not very close a few days in.
I am reading some books, I have got Clojure
and Leiningen
installed with a re-frame
Chestnut
template, the Clojure
plugin for VS Code, IntelliJ and Cursive up and running.
So I have a few mini questions:
Why on earth do I keep reading that you can use React with ClojureScript? React is obviously a JavaScript library.
What is js-interop and why would you use it?
Why are REPLs so important? If you're targeting the JVM or browser, why bother with a REPL?
Do I have to use lein run
before a REPL will run with updated code?
I get this error more than I get code to do anything:
user=> (run)
Syntax error compiling at (REPL:1:1).
Unable to resolve symbol: run in this context
What does it mean? This is what's stopping me from running Figwheel
.
Just learning Clojure now with a target of trying ClojureScript later, possibly with React. I have been at this for a few weeks now working through "The Joy of Clojure" (the book) and assorted websites and YouTube presentations and am still not ready to fully know what I am doing (though I have understood lazy evaluation and concurrency support. Yeah!). And I used to do a bit of Scheme ... a long time ago. Actually I have to diversify into just trying some development now because I'm getting downcast; there is a lot to digest.
clj
) or the REPL provided by Leiningen (start lein repl
), which is the REPL of Clojure with extras. There is probably a REPL for ClojureScript on Node.js, too. You can enter code directly or load it from a file using (load-file "file")
for example. run
to run. You have to write it first. lein run
executes the application inside a "project" directory layout, and will look for function -main
by default. Read up on Leiningen: Leiningen Tutorial.Be patient, this path is arduous and demands persistence.