Introduction
Clojure is a hosted language, which means that it runs on top of another language. In the same way that Clojure runs on top of the JVM, ClojureScript runs on top of JavaScript. More precisely, a ClojureScript program is transpiled into a JavaScript program that can run in the browser, on the server side, and in any environment where JavaScript is supported. For example, consider Node.js, an open source JavaScript server environment that allows us to execute JavaScript programs.
In this chapter, we will learn the basics of ClojureScript and how to create a ClojureScript program that runs in the browser. We will build a small frontend application on top of the Reagent framework that connects to an HTTP endpoint and displays User Interface (UI) components that the user can interact with. We will use Hiccup as a markup language for the UI components and discover how to execute JavaScript code from ClojureScript.
We will build an application using Figwheel, which supports...