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:

 :dependencies
 [...
  [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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.