Build the UI with Reagent

Reagent is a ClojureScript UI component library built on top of the popular Facebook React library.[44] Reagent provides a way to define UI elements using Hiccup-style syntax for DOM representation.[45][46] Each UI component is a data structure that represents a particular DOM element. By taking a DOM-centric view of the UI, Reagent provides a way to write composable components.

To build our UI, we first add the Reagent dependency to our project:

  [reagent ​"0.5.1"​]]

Let’s start the lein-cljsbuild plugin using the auto mode so that it watches for changes in the source and automatically recompiles it as we go. Nothing to it. Just open a new terminal and run the following command:

 lein cljsbuild ...

Get Web Development with Clojure, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.