Routes in ClojureScript

Davide Vernizzi
1 min readMar 21, 2018

--

I’m experimenting with Clojurescript; Clojurescript is wonderful (just as Clojure is) and with Reagent it is lots of fun. Unfortunately as for much of the Clojure-world there is not tons of documentation; however, there is a very handy recipe book that together with the basic documentation should get you up and running.

I have created a toy application to play with; it has some views and some basic routing. After a while I have refactored the code to separate views and routing from the core and move them into separate files, so to allow modularity.

Moving the code has been very easy (just copy and paste from the examples); the routing was slightly more trickier, but nothing too complex. Here’s how I did it.

I created the following function into each module (let’s say a blog section) I want to add:

and then in the core.cljs file I just include the module and call the function of the module

and that’s all.

--

--