Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to React - Triangle.rb May 2015
Search
Nathan Hunzaker
May 12, 2015
Technology
0
160
Introduction to React - Triangle.rb May 2015
The presentation I gave at Triangle.rb introducing React.
Nathan Hunzaker
May 12, 2015
Tweet
Share
More Decks by Nathan Hunzaker
See All by Nathan Hunzaker
React for Poets
nhunzaker
0
120
What is React?
nhunzaker
7
750
Other Decks in Technology
See All in Technology
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
130
ネットワーク可視化の世界
likr
6
5.1k
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
250
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
150
事業貢献を考えるための技術改善の目標設計と改善実績 / Targeted design of technical improvements to consider business contribution and improvement performance
oomatomo
0
170
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
320
Fearsome File Formats
ange
0
390
クレカ・銀行連携機能における “状態”との向き合い方 / SmartBank Engineer LT Event
smartbank
2
110
メンタル面でもつよつよエンジニアになる/登壇資料(井田 献一朗)
hacobu
0
150
ISUCON、今年も参加してみた / ISUCON, I challenged it again this year.
dero1to
0
110
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
130
普通のエンジニアがLaravelコアチームメンバーになるまで
avosalmon
0
600
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
67
4.5k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Into the Great Unknown - MozCon
thekraken
34
1.5k
Why Our Code Smells
bkeepers
PRO
335
57k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Transcript
React
Nate Hunzaker Front-end Developer, Viget @natehunzaker
We build lots of user interfaces
None
None
None
Every framework has a big idea
They don't just reinvent the wheel
“Backbone.js gives structure to web applications [...]”
“Ember.js is built for productivity. Designed with developer ergonomics in
mind...”
Keep it simple
“We can only hope to make reliable those things in
which we understand.” - Rich Hickey
• Composition • One way data flow • Static mental
model
Compo(sition,nents) "React is all about building reusable components. In fact,
with React the only thing you do is build components." - facebook.github.io/react
Encourage developers to break a user interface into small components.
<Blogs/> <Navigation/> <Posts/> <Post/> <Post/> <Post/> <Post/>
None
None
None
None
None
None
• No templates • Strange syntax
“Templates separate technology, not concerns.” - Pete Hunt (formerly of
Facebook)
None
JSX “The purpose of this specification is to define a
concise and familiar syntax for defining tree structures with attributes.” http://facebook.github.io/jsx/
None
None
None
How does this work?
None
None
npm install babel npm install react-tools
None
<main/> <Menu/> <Inbox/>
Virtual DOM
Build a DOM tree Compare to old state Get cheapest
mutation path (with Levenshtein) Write new DOM (in batches) New state
State changed! So what...
Imperative Programming Describe the transition between state
Declarative Programming Express the logic, not the flow
Define Interface Change State • Each change in state flushes
to the DOM • Properties are sent in one direction • No cascading updates
Let's talk about state
A component is given props A component manages state
A component is given props
A component manages state
That's kind of it
Static Rendering Model
This is fast
Holy Hot Modules! https://github.com/gaearon/react-hot-loader
Really fast
Static Mental Model
When you render to a virtual environment, the DOM becomes
an implementation detail
None
None
What is an isomorphic?
None
React.render() is idempotent Same in, same out
None
None
React.renderToStaticMarkup
None
How do I build real apps with this?
Flux “Flux [...] complements React's composable view components by utilizing
a unidirectional data flow.” http://facebook.github.io/flux/
None
I thought you said this was simple
Job Queue State State State I want to create a
widget Ready a widget! I can totally do that! Ch-ch-ch-ch- changes I love David Bowie!
Flux Formal Capacitor: A demo isomorphic Flux app https://github.com/vigetlabs/capacitor
Flux Fun http://www.natehunzaker.com/yappy-bird/
App State Stimuli New state
Initial State Sound Jump()
None
None
None
None
NuclearJS https://github.com/optimizely/nuclear-js Yahoo Flux https://github.com/yahoo/flux-examples Om (Clojurescript) https://github.com/swannodette/om
On that note...
React injects a few constraints that yield powerful benefits
By focusing on composability and a single direction flow of
data, we can greatly simplify our apps
Hopefully you didn't ignore me after the JSX :)
Thanks! Nate Hunzaker Front-end Developer, Viget @natehunzaker
Iconography: User interface icon by Aziz, the Noun Project http://thenounproject.com/azisher
JavaScript Logo: https://github.com/voodootikigod/logo.js General React Concepts: React Homepage http://facebook.github.io/react/ JSX Specification http://facebook.github.io/jsx/ Rethinking Best Practices, Pete Hunt: https://www.youtube.com/watch?v=x7cQ3mrcKaY Decomplexifying Code with React, Steven Luscher: https://www.youtube.com/watch?v=rI0GQc__0SM An Introduction to ReactJS, James Pierce https://www.youtube.com/watch?v=m2fuO2wl_3c Flux Flux Homepage http://facebook.github.io/flux/ Examples React Fun https://github.com/nhunzaker/react-fun React Animatable https://github.com/nhunzaker/react- animatable An Isomorphic Chart https://github.com/nhunzaker/an- isomorphic-chart Capacitor https://github.com/vigetlabs/capacitor Yappy Bird https://github.com/nhunzaker/yappy-bird
react-router: the best router https://github.com/rackt/react-router