Jim Lynch Codes
  • Blog
  • About Jim

Writings about one coder's stories & experiences.

How To Create A New Reagent ClojureScript Project!

10/15/2017

0 Comments

 
Reagent is an awesome marriage of a React, an industry standard web front-end based on immutable component state, with ClojureScript, a functional lisp programming language with a terse syntax that heavily leverages immutable data. This post is about how to easily create a Reagent project that will get you up and running with familiar tooling similar to other React and NodeJs. 

Leiningen Makes It Easy

In the NodeJs world you have build tools like webpack, gulp, and grunt. You have scaffolding utilities like yeoman, slush, or framework-specific cli's. You have a central registry of modules: npm. In the Clojure / ClojureScript world the command line utility lein pretty much does it all. You can install it pretty easily on most platforms by just downloading an installer file and clicking though it.

Scaffold a Figwheel Project With Reagent Plugin

The Leiningen (referred to as lein in the command line) function new is what I'm using here to create a new project. The figwheel project is a well-known Clojure boilerplate by Bruce Hauman for a nice coding experience where your front-end automatically updates in the browser without the need for a refresh, thus preserving app state. The next argument is the same of your project which I am naming "jims-fancy-example-project" in this case. By default this will create a folder with the name you enter, but I often like to add the flag "--to-dir ." to instead create the files in the current directory. Finally, we add the "-- --reagent" flag to use the reagent plugin which scaffolds our application as a reagent app. Here's the full command below.
lein new figwheel jims-fancy-example-project --to-dir . -- --reagent

The Awesomeness of ClojureScript

I first got into Clojure because I wanted to troll my boss by using the weirdest programming language I could find on codepad.io, but after learning and using it more I started to really appreciate it. Programmers who frequently use Clojure LOVE Clojure. Compared to JavaScript, the ClojureScript ecosystem is much, much smaller so it can be difficult to get help and build a team around a Clojure project, however many say that the terse syntax and declarative style make it much more readable and maintainable down the road. If you are a front-end programmer in 2017 I would not advise you to put all your eggs in one basket with ClojureScript, but I do believe that if you can understand a Reagent program it can really inspire you to use declarative functions, immutable state, and data-centric code.
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    ​Author

    Picture
    The posts on this site are written and maintained by Jim Lynch. About Jim...
    Follow @JimLynchCodes
    Follow @JimLynchCodes

    Categories

    All
    Actionscript 3
    Angular
    AngularJS
    Automated Testing
    AWS Lambda
    Behavior Driven Development
    Blockchain
    Blogging
    Business Building
    C#
    C / C++
    ClojureScript / Clojure
    Coding
    Community Service
    CS Philosophy
    Css / Scss
    Dev Ops
    Firebase
    Fitness
    Flash
    Front End
    Functional Programming
    Git
    Go Lang
    Haskell
    Illustrations
    Investing
    Java
    Javascript
    Lean
    Life
    Linux
    Logic Pro
    Music
    Node.js
    Planning
    Productivity
    Professionalism
    Python
    React
    Redux / Ngrx
    Refactoring
    Reusable Components
    Rust
    Security
    Serverless
    Shell Scripting
    Swift
    Test Driven Development
    Things
    TypeScript
    Useful Sites
    Useful Tools
    Video
    Website Development
    WebStorm
    Writing

    Archives

    August 2021
    February 2021
    January 2021
    October 2020
    September 2020
    May 2020
    April 2020
    February 2020
    January 2020
    December 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015

    RSS Feed

  • Blog
  • About Jim
JimLynchCodes © 2021