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
170
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
760
Other Decks in Technology
See All in Technology
『AWS Distinguished Engineerに学ぶ リトライの技術』 #ARC403/Marc Brooker on Try again: The tools and techniques behind resilient systems
quiver
0
130
これからSREになる人と、これからもSREをやっていく人へ
masayoshi
6
4.1k
スタートアップ1人目QAエンジニアが QAチームを立ち上げ、“個”からチーム、 そして“組織”に成長するまで / How to set up QA team at reiwatravel
mii3king
1
1.1k
TAMとre:Capセキュリティ編 〜拡張脅威検出デモを添えて〜
fujiihda
0
100
Postmanを使いこなす!2025年ぜひとも押さえておきたいPostmanの10の機能
nagix
2
120
[2025-02-07]生成AIで変える問い合わせの未来 〜チームグローバル化の香りを添えて〜
tosite
1
290
Googleマップ/Earthが一般化した 地図タイルのイマ
mapconcierge4agu
1
200
家電アプリ共通PF "Linova" のAPI利用とPostman活用事例ご紹介
yukiogawa
0
130
サーバーレスアーキテクチャと生成AIの融合 / Serverless Meets Generative AI
_kensh
12
3k
【Developers Summit 2025】プロダクトエンジニアから学ぶ、 ユーザーにより高い価値を届ける技術
niwatakeru
2
890
エンジニアの育成を支える爆速フィードバック文化
sansantech
PRO
3
660
株式会社EventHub・エンジニア採用資料
eventhub
0
4.2k
Featured
See All Featured
Building Your Own Lightsaber
phodgson
104
6.2k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
The Language of Interfaces
destraynor
156
24k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Navigating Team Friction
lara
183
15k
GraphQLとの向き合い方2022年版
quramy
44
13k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.1k
Embracing the Ebb and Flow
colly
84
4.6k
Being A Developer After 40
akosma
89
590k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
KATA
mclloyd
29
14k
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