SlideShare a Scribd company logo
Front-enD God-modE w /
ReagenT AnD FigwheeL
DaviD Y. KaY
State of Front-end Dev
Front-end God Mode with Reagent and Figwheel
State of the Art
• Write Code
• Reload Browser
• Lose Application State
• Manipulate Application State
• Test/verify behavior
• Repeat
Front-end God Mode with Reagent and Figwheel
Front-end God Mode with Reagent and Figwheel
Front-end God Mode with Reagent and Figwheel
Front-end God Mode with Reagent and Figwheel
Front-end God Mode with Reagent and Figwheel
Goal for this Talk
• How to develop code interactively
• Minimal incidental complexity
• Be the coolest kid on the block
Demo
• Show what Pharmasoft / Chat App Looks Like
• Show a one-line change
• Show the recursive nature of components
The Armory
Clojurescript Figwheel Reagent
Why Clojurescript?
Clojurescript
• More sane than JS
• Functional
• S-expressions
• Code is data
(defn square [x]
(* x x))
function square(x){
return x*x;
}
Why Figwheel?
Figwheel
3 Steps:
• Edit
• Save
• Watch in Awe
Bret Victor - Inventing on Principle
Figwheel
• Pro:
• Code changes occur instantly
• App state is maintained
• Con:
• Have to write code so that it’s reloadable
Front-end God Mode with Reagent and Figwheel
Code Changes
Figwheel Server
(Lein figwheel)
CLJS App
Figwheel
Client
Why Reagent?
Reagent
• a minimal, sleek React.js
• SIMPLE
• Dataflow!
• Likened more to Elm than React.js
Atoms
(defonce app-state
(r/atom {:chat-input ""
:messages []
:username
"Anon"}))
(swap! app-state assoc :username
"David")
(reset! app-state new-state)
Adjust with Feedback
• Show some mis-steps, correct them
Review
• Clojurescript
• Figwheel
• Reagent
Front-end God Mode with Reagent and Figwheel
Come for the workshop!
Front-end God Mode with Reagent and Figwheel
Front-end God Mode with Reagent and Figwheel
MailinG LisT
www.davidykay.com/i-love-clojurescript
ReagenT AnD FigwheeL
WorkshoP
Installing the Tools
brew install leiningen
Running the Code
Terminal 1:
lein ring server
Terminal 2:
lein figwheel
Part 0: Prologue
Set the Goal
• By the end of this workshop, you should be able
to create a chat client using CLJS, Foundation,
Reagent, and Figwheel
• Here’s what it looks like…
Demo
• Show what Chat App Looks Like
Front-end God Mode with Reagent and Figwheel
Roadmap
• Clojurescript
• Data structures
• Functions
• Figwheel
• Reagent
• Atoms
• Components
• Putting it all together - Chat App
Part 1: Intro
Figwheel
• Pro:
• Code changes occur instantly
• App state is maintained
• Con:
• Have to write code so that it’s reloadable
Hello World
lein new figwheel chat
cd chat
lein figwheel
view localhost:3449
Clojurescript
(defn square [x]
(* x x))
Data Structures
List - ( )
Vector - [ ]
Map - { }
Set - #{ }
(def app-db {:greeting "Hello Van FP!"
:email “david@vanfp.com"
:password ""
:screen :login})
(if (= id (:current-condition @app-
state))
"current"
"")
(fn [n]
(clojure.string/join
" "
"tabs-title"
(if (= n (:active-tab @app-state))
"is-active"
nil)]))
Part 2: Basics
Reagent
Hiccup Syntax
[:div.top-bar-right
[:ul.menu
[:li [:a {:href "#"} "History"]]
[:li [:a {:href "#"} "Log Out"]]]]
Button Handler
[:button {:class "button"
:on-click
#(do
(refresh-messages)
(.preventDefault %))}
"Refresh"]
Button Handler
[:button {:class "button"
:on-click
(fn [ev]
(refresh-messages)
(.preventDefault ev))}
"Refresh"]
Button Handler
(defn handle-click [ev]
(refresh-messages)
(.preventDefault ev))
[:button {:class "button"
:on-click handle-click}
"Refresh"]
Atoms
(defonce app-state
(r/atom {:chat-input ""
:messages []
:username
"Anon"}))
(swap! app-state assoc :username
"David")
(reset! app-state new-state)
Atoms
(swap! app-state assoc :username
“David")
(swap! app-state (fn [old]
(assoc old :username “david”))
(reset! app-state new-state)
Text Input
[:input
{:placeholder "Neo",
:type "text"
:value (:username @app-state)
:on-change
(fn [ev]
(swap! app-state
assoc
:username
(-> ev .-target .-value)))}]
Text Input
(-> ev
.-target
.-value)
(:value (:target ev))
(.-value (.-target ev))
Part 3: Intermediate
HTTP Calls
(GET "/" {:handler (fn [response]
(println response))
:error-handler error-handler})
(defn error-handler
[{:keys [status status-text]}]
(println "error code: " status
" " status-text))
Reagent Component
(defn component [medication]
[:div
[:h2 "Pre-Interview Notes"]
[:p (:general-notes @app-state)]
[:form
...]])
Review
• Figwheel
• Reloadable code
• Clojurescript
• Reagent
• Ratoms
• Components
Resources
• Figwheel Talk at Clojure/West 2015
• Reagent Docs - holmsand.github.io/reagent/
MailinG LisT
www.davidykay.com/i-love-clojurescript
ExtrA ImageS
Front-end God Mode with Reagent and Figwheel
Front-end God Mode with Reagent and Figwheel
Front-end God Mode with Reagent and Figwheel

More Related Content

PPTX
10 minute command line apps with zio cli
PDF
Let's Graph
PPTX
PDF
Plotly dash and data visualisation in Python
PDF
MLBlock
PPTX
Relay: Seamless Syncing for React (VanJS)
PDF
PPTX
Declarative authorization in REST services in SharePoint with F# and ServiceS...
10 minute command line apps with zio cli
Let's Graph
Plotly dash and data visualisation in Python
MLBlock
Relay: Seamless Syncing for React (VanJS)
Declarative authorization in REST services in SharePoint with F# and ServiceS...

What's hot (20)

PDF
[JCConf 2017] Reactive Programming with Reactor
PDF
Engineering Efficiency in LINE
PDF
Elixir + GraphQL = Absinthe 2019.04.10
PDF
GraphQL With Relay Part Deux
PDF
Domain Driven Rails
PDF
GraphQL in an Age of REST
PPTX
Design Summit - UI Roadmap - Dan Clarizio, Martin Povolny
PDF
Flowex - Railway Flow-Based Programming with Elixir GenStage.
PDF
GraphQL + relay
PDF
The Apollo and GraphQL Stack
PDF
GraphQL
PDF
Jetpack joyride!
PDF
OUG Ireland 2019 - building free, open-source, PL/SQL products in cloud
PDF
Why should a Java programmer shifts towards Functional Programming Paradigm
PPTX
PPTX
ruby-on-rails-and-ember-cli
ODP
Elixir and elm - the perfect couple
PDF
Modular GraphQL with Schema Stitching
PPTX
Introduction to GraphQL
PDF
Adding GraphQL to your existing architecture
[JCConf 2017] Reactive Programming with Reactor
Engineering Efficiency in LINE
Elixir + GraphQL = Absinthe 2019.04.10
GraphQL With Relay Part Deux
Domain Driven Rails
GraphQL in an Age of REST
Design Summit - UI Roadmap - Dan Clarizio, Martin Povolny
Flowex - Railway Flow-Based Programming with Elixir GenStage.
GraphQL + relay
The Apollo and GraphQL Stack
GraphQL
Jetpack joyride!
OUG Ireland 2019 - building free, open-source, PL/SQL products in cloud
Why should a Java programmer shifts towards Functional Programming Paradigm
ruby-on-rails-and-ember-cli
Elixir and elm - the perfect couple
Modular GraphQL with Schema Stitching
Introduction to GraphQL
Adding GraphQL to your existing architecture
Ad

Similar to Front-end God Mode with Reagent and Figwheel (20)

PDF
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
PDF
Building a web application with ontinuation monads
PDF
Guides To Analyzing WebKit Performance
PDF
ClojureScript interfaces to React
PPTX
20180518 QNAP Seminar - Introduction to React Native
PPTX
Tools and practices for rapid application development
PDF
ClojureScript for the web
PPTX
JS Essence
PDF
web2py:Web development like a boss
PPTX
Javascript
PDF
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
PDF
Griffon for the Enterprise
PPTX
German introduction to sp framework
PPTX
5 x HTML5 worth using in APEX (5)
PPTX
O365 Developer Bootcamp NJ 2018 - Material
PDF
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
PPTX
Silicon Valley JUG - How to generate customized java 8 code from your database
PPTX
How to generate customized java 8 code from your database
PPTX
RapidApp - YAPC::NA 2014
PDF
Om nom nom nom
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
Building a web application with ontinuation monads
Guides To Analyzing WebKit Performance
ClojureScript interfaces to React
20180518 QNAP Seminar - Introduction to React Native
Tools and practices for rapid application development
ClojureScript for the web
JS Essence
web2py:Web development like a boss
Javascript
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Griffon for the Enterprise
German introduction to sp framework
5 x HTML5 worth using in APEX (5)
O365 Developer Bootcamp NJ 2018 - Material
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
Silicon Valley JUG - How to generate customized java 8 code from your database
How to generate customized java 8 code from your database
RapidApp - YAPC::NA 2014
Om nom nom nom
Ad

More from David Kay (6)

PDF
Cross platform native development in f#
PDF
How to Start a Med Device Startup From Your Garage - Vancouver Edition
PDF
Drag and Drop UI Development with React Native
PDF
Intro to Apache Storm
PDF
App architecture101
PDF
Slaying Bugs with Gradle and Jenkins
Cross platform native development in f#
How to Start a Med Device Startup From Your Garage - Vancouver Edition
Drag and Drop UI Development with React Native
Intro to Apache Storm
App architecture101
Slaying Bugs with Gradle and Jenkins

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Cloud computing and distributed systems.
PDF
Modernizing your data center with Dell and AMD
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation theory and applications.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
A Presentation on Artificial Intelligence
PDF
cuic standard and advanced reporting.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Big Data Technologies - Introduction.pptx
PPT
Teaching material agriculture food technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Cloud computing and distributed systems.
Modernizing your data center with Dell and AMD
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation theory and applications.pdf
NewMind AI Monthly Chronicles - July 2025
A Presentation on Artificial Intelligence
cuic standard and advanced reporting.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Digital-Transformation-Roadmap-for-Companies.pptx
Big Data Technologies - Introduction.pptx
Teaching material agriculture food technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectral efficient network and resource selection model in 5G networks
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy

Front-end God Mode with Reagent and Figwheel