SlideShare a Scribd company logo
Introduction to
Functional Reactive Web
by John Stevenson
@jr0cket practicalli.github.io/clojurescript
@jr0cket
Speaker, author, conference organiser & community obsessed
developer.
Love Clojure, Emacs, Cats, Cycling & Agile development.
@Heroku
@SalesforceDevs
#Trailhead
In a galaxy far, far away…
Why
Functional Reactive Web
it's not just because it's really fun...
Complex languages
… are simply not
easy to understand
@jr0cket
Josh Smith - Tweet
Original Gif
The Complexity Iceberg
- @krisajenkins
● complexity is very
dangerous when hidden
● You can't know what a
function does for certain if it
has side effects
Side Effects
Pure Functions
The results of the function are purely determined by its initial output and its own code
- no external influence, a function only uses local values
- referential transparency (the function can be replaced by its value)
Impure Functions - side causes
The results of the function are purely determined by its initial output and its own code
- behaviour externally influenced and non-deterministic
Eliminating Side Effects
Functional programming is about eliminating side effects where you can,
controlling them where you can't - @krisajenkins
The features in Functional Programming come from a
desire to reduce side effects
ClojureScript - Functional Web
Immutability & composable functions for Web Apps
Introduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with Clojurescript
jQuery over all JavaScript frameworks
Introduction to Functional Reactive Web with Clojurescript
Google Closure tools & libraries
Introduction to Functional Reactive Web with Clojurescript
ClojureScript Quickstart
Peeks under the covers of how to build and run Clojurescript generated JavaScript
Introduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with Clojurescript
Getting Started with
Clojurescript
Clojurescript Environments
Nashorn
- built into JVM, access Java classes
- Oracle Nashorn: A Next-Generation JavaScript Engine for the JVM
Browser-REPL
- built into modern browsers (Chrome, Firefox, etc)
- commonly used for client side web apps
Node.js
- great for command line utilities and microservices!
Common Clojurescript Tooling
Figwheel (leiningen plugin)
- defacto tool for client side web apps
- live reload and so much more...
Figwheel-sidecar
- connecting Emacs to figwheel
Full-stack projects: Chestnut
https://github.com/plexus/chestnut
- leiningen template for Clojure/ClojureScript apps based
- with Om, Reagent, or Rum
- instant reloading of Clojure, ClojureScript, and CSS
- browser-connected REPL included
lein new chestnut project-name
Self-hosted Clojurescript Environments
Instant startup times, great for command line tools
Lumo (cross-platform)
- https://github.com/anmonteiro/lumo
Plank (Mac & Linux)
- http://planck-repl.org/
Understanding React
Basic concepts of React
https://facebook.github.io/react/
https://github.com/reactjs
React Basics
React provides an efficient way to update the view
What React Provides
React is only the view
You DO NOT GET any of the following:
An event system (other than vanilla DOM events)
Any AJAX capabilities whatsoever
Any form of a data layer
Promises
Any application framework at all
Any idea how implement the above
How React Works (Simplified)
Your view triggers an event
- a user types a name in a text field
That event updates a model
Then the model triggers an event
And the view responds to that model's event by
re-rendering with the latest data.
This one way data flow / decoupled observer
pattern is designed to guarantee that your source
of truth always stays in your stores / models
JSX
JSX is a preprocessor step that adds XML syntax to JavaScript.
You can definitely use React without JSX but JSX makes React a lot more elegant.
Just like XML, JSX tags have a tag name, attributes, and children.
If an attribute value is enclosed in quotes, the value is a string.
Reactive Frameworks
All the varieties of life, plus all the Javascript varieties too...
Javascript & Clojurescript frameworks
Javascript
● React.js via cljsjs
● Vue.js ???
Clojurescript
● Om / Om-next
● Reagent / Reframe
● Rum
More at https://clojurescript.org/community/libraries
Reagent
Interactive development
Reagent
Reagent provides a minimalistic interface between ClojureScript and React. It allows you to define efficient React components using
nothing but plain ClojureScript functions and data, that describe your UI using a Hiccup-like syntax.
The goal of Reagent is to make it possible to define arbitrarily complex UIs using just a couple of basic concepts, and to be fast
enough by default that you rarely have to care about performance.
Reagent Core functions
reagent.core/render
- Render a Reagent component into the DOM
- First argument is either a vector (Reagent Hiccup syntax) or a React element
reagent.core/atom
- Like clojure.core/atom, plus it tracks components that deref atom & re-renders them
Reagent Helper functions
clj->js
- convert values from clojurescript to javascript
js->clj
- transforms JavaScript arrays into ClojureScript vectors, and JavaScript objects
into ClojureScript maps
Reframe
A micro-framework for Reagent
Reframe
re-frame is a pattern for writing SPAs in ClojureScript, using Reagent.
Being a functional framework, it is about data, and the (pure) functions which
transform that data.
It is a loop
Architecturally, re-frame implements "a perpetual loop".
To build an app, you hang pure functions on certain parts of this loop, and re-frame
looks after the conveyance of data around the loop, into and out of the transforming
functions you provide - hence a tag line of "Derived Values, Flowing".
Om / Om-next
ClojureScript interface to Facebook's React
Om / Om-next
Om allows users to represent their UIs simply as EDN. Because ClojureScript data is immutable data, Om can always rapidly
re-render the UI from the root. Thus Om UIs are out of the box snapshotable and undoable and these operations have no
implementation complexity and little overhead.
See for yourself.
Unique Features
Om supports features not currently present in React:
● Global state management facilities built in
● Components may have arbitrary data dependencies, not limited to props & state
● Component construction can be intercepted via :instrument. Simplifies debugging components and generic editors.
● Provides stream of all application state change deltas via :tx-listen. Simplifies synchronization online and offline.
● Customizable semantics. Fine grained control over how components store state, even for components outside of your control.
Simplifies using Om components outside the Om framework, debugging, and adding event hooks not anticipated by original
component designer.
Om core functions
om.core/IRender
- Render a Om component into the DOM
- uses reify to provide a specific implementation of the om/IRender interface
om.dom/div attributes content
- creates a <div> tag in react
- all react tags need to be wrapped in a div in order to be rendered
- om.dom/… has all the other tags too - h1, h2, p, a … (sablono can be used instead)
#js
- converts clojure maps into Javascript objects
- nest #js functions to to create JS objects - eg. for inline styles
Om Cursors
Cursors are a fundamental part of Om. They let components refer to pieces of
the app state without knowing where they are in the state tree. This makes
updating the app state simple, as the cursor is already pointing to the correct
part of the app state.
cursors are like maps, but cursors also let you write to them
A cursor is an atom & a path to a location in the atom
appstate :entries 0
Rum
A micro-framework for Reagent
Rum
Rum is a client/server library for HTML UI. In ClojureScript, it works as React wrapper, in Clojure, it is a static HTML
generator.
- Simple semantics: Rum is arguably smaller, simpler and more straightforward than React itself.
- Decomplected: Rum is a library, not a framework. Use only the parts you need, throw away or replace what you don’t
need, combine different approaches in a single app, or even combine Rum with other frameworks.
- No enforced state model: Unlike Om, Reagent or Quiescent, Rum does not dictate where to keep your state. Instead, it
works well with any storage: persistent data structures, atoms, DataScript, JavaScript objects, localStorage or any custom
solution you can think of.
- Extensible: the API is stable and explicitly defined, including the API between Rum internals. It lets you build custom
behaviours that change components in significant ways.
- Minimal codebase: You can become a Rum expert just by reading its source code (~900 lines).
ClojureScript Demo
Interactive development
Figwheel (flappy birds example)
Take your own journey into Clojure
@jr0cket
@Heroku
@SalesforceDevs
#Trailhead
In a galaxy far, far away… London, UK
Clojure - Functional Web
Immutability & composable functions for Web Apps
Ring - simplifying communication
Ring takes requests over HTTP and converts them into a map (think JSON)
Ring - creating an embedded server
Compojure - simplifying routing
Compojure routes requests based on path & request type
Compojure - defining routes
Hiccup - html from Clojure
Ring - embedded server & dependencies

More Related Content

What's hot (20)

PPTX
Best Practices in Qt Quick/QML - Part I
ICS
 
PDF
Serving QML applications over the network
Jeremy LainĂŠ
 
PDF
"Xapi-lang For declarative code generation" By James Nelson
GWTcon
 
PPTX
A Tour of PostgREST
begriffs
 
PDF
Play framework
Andrew Skiba
 
PDF
Angular Extreme Performance - V2
Gustavo Costa
 
PDF
Practical pairing of generative programming with functional programming.
Eugene Lazutkin
 
PDF
React native
Vishal Dubey
 
PPTX
Vue next
Vitalii Ratyshnyi
 
PDF
Angular 2 Crash Course
Elisha Kramer
 
PDF
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Schalk CronjĂŠ
 
KEY
Jruby synergy-of-ruby-and-java
Keith Bennett
 
PPSX
Writing code that writes code - Nguyen Luong
Vu Huy
 
PDF
Gradle in 45min - JBCN2-16 version
Schalk CronjĂŠ
 
PDF
Let's migrate to Swift 3.0
CocoaHeads France
 
ODP
GWT 2 Is Smarter Than You
Robert Cooper
 
PDF
Functional Reactive Programming in the Netflix API
C4Media
 
PDF
React Native Evening
Troy Miles
 
PDF
Gradle in 45min
Schalk CronjĂŠ
 
Best Practices in Qt Quick/QML - Part I
ICS
 
Serving QML applications over the network
Jeremy LainĂŠ
 
"Xapi-lang For declarative code generation" By James Nelson
GWTcon
 
A Tour of PostgREST
begriffs
 
Play framework
Andrew Skiba
 
Angular Extreme Performance - V2
Gustavo Costa
 
Practical pairing of generative programming with functional programming.
Eugene Lazutkin
 
React native
Vishal Dubey
 
Vue next
Vitalii Ratyshnyi
 
Angular 2 Crash Course
Elisha Kramer
 
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Schalk CronjĂŠ
 
Jruby synergy-of-ruby-and-java
Keith Bennett
 
Writing code that writes code - Nguyen Luong
Vu Huy
 
Gradle in 45min - JBCN2-16 version
Schalk CronjĂŠ
 
Let's migrate to Swift 3.0
CocoaHeads France
 
GWT 2 Is Smarter Than You
Robert Cooper
 
Functional Reactive Programming in the Netflix API
C4Media
 
React Native Evening
Troy Miles
 
Gradle in 45min
Schalk CronjĂŠ
 

Similar to Introduction to Functional Reactive Web with Clojurescript (20)

PDF
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
Codemotion
 
PPTX
Rethinking Best Practices
floydophone
 
PPTX
React gsg presentation with ryan jung &amp; elias malik
Lama K Banna
 
PPTX
Introduction to ReactJS UI Web Dev .pptx
SHAIKIRFAN715544
 
PPTX
Introduction to React JS.pptx
SHAIKIRFAN715544
 
PDF
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
 
PDF
React Native +Redux + ES6 (Updated)
Chiew Carol
 
PDF
React Js Simplified
Sunil Yadav
 
PPTX
unit 2 React js.pptxdgdgdgdgdgdgdgdgdsgdgdg
zmulani8
 
PDF
React Interview Question PDF By ScholarHat
Scholarhat
 
PPTX
React-JS.pptx
AnmolPandita7
 
PDF
Daniel Steigerwald - Este.js - konec velkĂŠho Schizma
Develcz
 
PDF
Welcome to React & Flux !
Ritesh Kumar
 
PPTX
Building reusable components as micro frontends with glimmer js and webcompo...
Andrei Sebastian CĂŽmpean
 
PDF
100 React Interview questions 2024.pptx.pdf
codevincent624
 
PDF
Learning React js Learn React JS From Scratch with Hands On Projects 2nd Edit...
bandmvh3697
 
PDF
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Elixir Club
 
PPTX
React Workshop
GDSC UofT Mississauga
 
PDF
REACTJS.pdf
ArthyR3
 
PPTX
This Is the ppt of How the react js work in the dealy life
AmanKoli6
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
Codemotion
 
Rethinking Best Practices
floydophone
 
React gsg presentation with ryan jung &amp; elias malik
Lama K Banna
 
Introduction to ReactJS UI Web Dev .pptx
SHAIKIRFAN715544
 
Introduction to React JS.pptx
SHAIKIRFAN715544
 
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
 
React Native +Redux + ES6 (Updated)
Chiew Carol
 
React Js Simplified
Sunil Yadav
 
unit 2 React js.pptxdgdgdgdgdgdgdgdgdsgdgdg
zmulani8
 
React Interview Question PDF By ScholarHat
Scholarhat
 
React-JS.pptx
AnmolPandita7
 
Daniel Steigerwald - Este.js - konec velkĂŠho Schizma
Develcz
 
Welcome to React & Flux !
Ritesh Kumar
 
Building reusable components as micro frontends with glimmer js and webcompo...
Andrei Sebastian CĂŽmpean
 
100 React Interview questions 2024.pptx.pdf
codevincent624
 
Learning React js Learn React JS From Scratch with Hands On Projects 2nd Edit...
bandmvh3697
 
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Elixir Club
 
React Workshop
GDSC UofT Mississauga
 
REACTJS.pdf
ArthyR3
 
This Is the ppt of How the react js work in the dealy life
AmanKoli6
 
Ad

More from John Stevenson (20)

PDF
ClojureX Conference 2017 - 10 amazing years of Clojure
John Stevenson
 
PDF
Confessions of a developer community builder
John Stevenson
 
PDF
Thinking Functionally with Clojure
John Stevenson
 
PDF
Communication improbable
John Stevenson
 
PDF
Getting into public speaking at conferences
John Stevenson
 
PDF
Functional web with clojure
John Stevenson
 
PDF
Get into Functional Programming with Clojure
John Stevenson
 
PDF
Guiding people into Clojure
John Stevenson
 
PDF
Git and github - Verson Control for the Modern Developer
John Stevenson
 
PDF
Get Functional Programming with Clojure
John Stevenson
 
PDF
So you want to run a developer event, are you crazy?
John Stevenson
 
PPTX
Trailhead live - Overview of Salesforce App Cloud
John Stevenson
 
PDF
Clojure for Java developers
John Stevenson
 
PPTX
Introducing the Salesforce platform
John Stevenson
 
PPT
Dreamforce14 Metadata Management with Git Version Control
John Stevenson
 
ODP
Getting started with Clojure
John Stevenson
 
PPT
Salesforce Summer of Hacks London - Introduction
John Stevenson
 
PPTX
Heroku Introduction: Scaling customer facing apps & services
John Stevenson
 
PPT
Developers guide to the Salesforce1 Platform
John Stevenson
 
PPTX
Developer week EMEA - Salesforce1 Mobile App overview
John Stevenson
 
ClojureX Conference 2017 - 10 amazing years of Clojure
John Stevenson
 
Confessions of a developer community builder
John Stevenson
 
Thinking Functionally with Clojure
John Stevenson
 
Communication improbable
John Stevenson
 
Getting into public speaking at conferences
John Stevenson
 
Functional web with clojure
John Stevenson
 
Get into Functional Programming with Clojure
John Stevenson
 
Guiding people into Clojure
John Stevenson
 
Git and github - Verson Control for the Modern Developer
John Stevenson
 
Get Functional Programming with Clojure
John Stevenson
 
So you want to run a developer event, are you crazy?
John Stevenson
 
Trailhead live - Overview of Salesforce App Cloud
John Stevenson
 
Clojure for Java developers
John Stevenson
 
Introducing the Salesforce platform
John Stevenson
 
Dreamforce14 Metadata Management with Git Version Control
John Stevenson
 
Getting started with Clojure
John Stevenson
 
Salesforce Summer of Hacks London - Introduction
John Stevenson
 
Heroku Introduction: Scaling customer facing apps & services
John Stevenson
 
Developers guide to the Salesforce1 Platform
John Stevenson
 
Developer week EMEA - Salesforce1 Mobile App overview
John Stevenson
 
Ad

Recently uploaded (20)

DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 

Introduction to Functional Reactive Web with Clojurescript

  • 1. Introduction to Functional Reactive Web by John Stevenson @jr0cket practicalli.github.io/clojurescript
  • 2. @jr0cket Speaker, author, conference organiser & community obsessed developer. Love Clojure, Emacs, Cats, Cycling & Agile development. @Heroku @SalesforceDevs #Trailhead In a galaxy far, far away…
  • 3. Why Functional Reactive Web it's not just because it's really fun...
  • 4. Complex languages … are simply not easy to understand @jr0cket Josh Smith - Tweet Original Gif
  • 5. The Complexity Iceberg - @krisajenkins ● complexity is very dangerous when hidden ● You can't know what a function does for certain if it has side effects
  • 7. Pure Functions The results of the function are purely determined by its initial output and its own code - no external influence, a function only uses local values - referential transparency (the function can be replaced by its value)
  • 8. Impure Functions - side causes The results of the function are purely determined by its initial output and its own code - behaviour externally influenced and non-deterministic
  • 9. Eliminating Side Effects Functional programming is about eliminating side effects where you can, controlling them where you can't - @krisajenkins The features in Functional Programming come from a desire to reduce side effects
  • 10. ClojureScript - Functional Web Immutability & composable functions for Web Apps
  • 13. jQuery over all JavaScript frameworks
  • 15. Google Closure tools & libraries
  • 17. ClojureScript Quickstart Peeks under the covers of how to build and run Clojurescript generated JavaScript
  • 21. Clojurescript Environments Nashorn - built into JVM, access Java classes - Oracle Nashorn: A Next-Generation JavaScript Engine for the JVM Browser-REPL - built into modern browsers (Chrome, Firefox, etc) - commonly used for client side web apps Node.js - great for command line utilities and microservices!
  • 22. Common Clojurescript Tooling Figwheel (leiningen plugin) - defacto tool for client side web apps - live reload and so much more... Figwheel-sidecar - connecting Emacs to figwheel
  • 23. Full-stack projects: Chestnut https://github.com/plexus/chestnut - leiningen template for Clojure/ClojureScript apps based - with Om, Reagent, or Rum - instant reloading of Clojure, ClojureScript, and CSS - browser-connected REPL included lein new chestnut project-name
  • 24. Self-hosted Clojurescript Environments Instant startup times, great for command line tools Lumo (cross-platform) - https://github.com/anmonteiro/lumo Plank (Mac & Linux) - http://planck-repl.org/
  • 27. React Basics React provides an efficient way to update the view
  • 28. What React Provides React is only the view You DO NOT GET any of the following: An event system (other than vanilla DOM events) Any AJAX capabilities whatsoever Any form of a data layer Promises Any application framework at all Any idea how implement the above
  • 29. How React Works (Simplified) Your view triggers an event - a user types a name in a text field That event updates a model Then the model triggers an event And the view responds to that model's event by re-rendering with the latest data. This one way data flow / decoupled observer pattern is designed to guarantee that your source of truth always stays in your stores / models
  • 30. JSX JSX is a preprocessor step that adds XML syntax to JavaScript. You can definitely use React without JSX but JSX makes React a lot more elegant. Just like XML, JSX tags have a tag name, attributes, and children. If an attribute value is enclosed in quotes, the value is a string.
  • 31. Reactive Frameworks All the varieties of life, plus all the Javascript varieties too...
  • 32. Javascript & Clojurescript frameworks Javascript ● React.js via cljsjs ● Vue.js ??? Clojurescript ● Om / Om-next ● Reagent / Reframe ● Rum More at https://clojurescript.org/community/libraries
  • 34. Reagent Reagent provides a minimalistic interface between ClojureScript and React. It allows you to define efficient React components using nothing but plain ClojureScript functions and data, that describe your UI using a Hiccup-like syntax. The goal of Reagent is to make it possible to define arbitrarily complex UIs using just a couple of basic concepts, and to be fast enough by default that you rarely have to care about performance.
  • 35. Reagent Core functions reagent.core/render - Render a Reagent component into the DOM - First argument is either a vector (Reagent Hiccup syntax) or a React element reagent.core/atom - Like clojure.core/atom, plus it tracks components that deref atom & re-renders them
  • 36. Reagent Helper functions clj->js - convert values from clojurescript to javascript js->clj - transforms JavaScript arrays into ClojureScript vectors, and JavaScript objects into ClojureScript maps
  • 38. Reframe re-frame is a pattern for writing SPAs in ClojureScript, using Reagent. Being a functional framework, it is about data, and the (pure) functions which transform that data. It is a loop Architecturally, re-frame implements "a perpetual loop". To build an app, you hang pure functions on certain parts of this loop, and re-frame looks after the conveyance of data around the loop, into and out of the transforming functions you provide - hence a tag line of "Derived Values, Flowing".
  • 39. Om / Om-next ClojureScript interface to Facebook's React
  • 40. Om / Om-next Om allows users to represent their UIs simply as EDN. Because ClojureScript data is immutable data, Om can always rapidly re-render the UI from the root. Thus Om UIs are out of the box snapshotable and undoable and these operations have no implementation complexity and little overhead. See for yourself. Unique Features Om supports features not currently present in React: ● Global state management facilities built in ● Components may have arbitrary data dependencies, not limited to props & state ● Component construction can be intercepted via :instrument. Simplifies debugging components and generic editors. ● Provides stream of all application state change deltas via :tx-listen. Simplifies synchronization online and offline. ● Customizable semantics. Fine grained control over how components store state, even for components outside of your control. Simplifies using Om components outside the Om framework, debugging, and adding event hooks not anticipated by original component designer.
  • 41. Om core functions om.core/IRender - Render a Om component into the DOM - uses reify to provide a specific implementation of the om/IRender interface om.dom/div attributes content - creates a <div> tag in react - all react tags need to be wrapped in a div in order to be rendered - om.dom/… has all the other tags too - h1, h2, p, a … (sablono can be used instead) #js - converts clojure maps into Javascript objects - nest #js functions to to create JS objects - eg. for inline styles
  • 42. Om Cursors Cursors are a fundamental part of Om. They let components refer to pieces of the app state without knowing where they are in the state tree. This makes updating the app state simple, as the cursor is already pointing to the correct part of the app state. cursors are like maps, but cursors also let you write to them A cursor is an atom & a path to a location in the atom appstate :entries 0
  • 44. Rum Rum is a client/server library for HTML UI. In ClojureScript, it works as React wrapper, in Clojure, it is a static HTML generator. - Simple semantics: Rum is arguably smaller, simpler and more straightforward than React itself. - Decomplected: Rum is a library, not a framework. Use only the parts you need, throw away or replace what you don’t need, combine different approaches in a single app, or even combine Rum with other frameworks. - No enforced state model: Unlike Om, Reagent or Quiescent, Rum does not dictate where to keep your state. Instead, it works well with any storage: persistent data structures, atoms, DataScript, JavaScript objects, localStorage or any custom solution you can think of. - Extensible: the API is stable and explicitly defined, including the API between Rum internals. It lets you build custom behaviours that change components in significant ways. - Minimal codebase: You can become a Rum expert just by reading its source code (~900 lines).
  • 47. Take your own journey into Clojure
  • 49. Clojure - Functional Web Immutability & composable functions for Web Apps
  • 50. Ring - simplifying communication Ring takes requests over HTTP and converts them into a map (think JSON)
  • 51. Ring - creating an embedded server
  • 52. Compojure - simplifying routing Compojure routes requests based on path & request type
  • 54. Hiccup - html from Clojure
  • 55. Ring - embedded server & dependencies