Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ClojureScript and React without JavaScript

Rakhim
February 21, 2019

ClojureScript and React without JavaScript

Web development and modern JS ecosystem can be daunting, especially if you like simplicity, immutability and FP. Being able to create complex React Apps without using any JavaScript, but rather compiling from Clojurescript is a breath of fresh air. I'd like to share my experience writing React-powered apps using Clojurescript, Reagent and Figwheel.

ClojureScript compiles to JavaScript and, thanks to modern tools like Reagent and Figwheel, actually make writing React apps easier than with traditional React JS library. These apps are also generally faster than natively-written ones, thanks to build-in immutability and leveraging the Google Closure compiler. We need more functional programmers on the frontend side! The web is going somewhere dark, and we can help.

Rakhim

February 21, 2019
Tweet

More Decks by Rakhim

Other Decks in Programming

Transcript

  1. whoami • Software developer since 2010 • Teaching programming since

    2012 • hexlet.io until 2019 • now codexpanse.com @freetonik rakhim.org
  2. React • Declarative • Component based • JS library for

    UI • because UI is hard • because DOM
  3. Avoid JS? • TypeScript • Optional static typing • Elm

    • Influenced by Haskell, ML, OCaml, F# • Static typing + static type checking • Immutable data, persistent data structures • ReasonML • OCaml + static typing
  4. Clojure • Dynamic • Compiled • Dialect of LISP •

    Works on top of JVM • Homoiconic • Data-driven • lists '(a b c) • vectors [a b c] • maps {:a "foo" :b "boo"} • sets #{a b c} • Immutable
  5. Simple infrastructure JavaScript Clojure Scaffolding Grunt, Yeoman, Slush Leiningen, Boot

    Building Webpack, Grunt, Gulp Leiningen, Boot Package management npm, yarn, bower Leiningen, Boot or deps.edn
  6. ClojureScript • Clojure -> JavaScript compiler • Takes advantage of

    Google Closure • (some) code sharing backend <-> frontend • Smaller than jQuery • Faster than JS for React o_O
  7. Resources Clojure(Script) • Rich Hickey's talks (at least "Simple Made

    Easy") • Clojure For The Brave • Luminus “Framework" ClojureScript • https: //clojurescript.io/ • Reagent intro docs • re-frame docs