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
Reactjs @ MOSUT x Tainan.py
Search
Yuanhsiang Cheng
August 25, 2014
Technology
360
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Reactjs @ MOSUT x Tainan.py
Yuanhsiang Cheng
August 25, 2014
More Decks by Yuanhsiang Cheng
See All by Yuanhsiang Cheng
How to rebuild a websocket service by golang and redis
yhsiang
0
1.1k
From React to React Native Web
yhsiang
0
220
Rethink React in Elm
yhsiang
0
1.1k
開源與工程師的自我修養
yhsiang
0
230
Sayit in Taiwan
yhsiang
0
210
LY sayit
yhsiang
0
190
Webpack pack your web
yhsiang
17
12k
2015 Summer of ?
yhsiang
0
330
How to be a good wan-jun
yhsiang
1
190
Other Decks in Technology
See All in Technology
Claude Codeをどのように キャッチアップしているか
oikon48
13
8.3k
なぜ Platform Engineering の土台に Kubernetes を選ぶのか
r4ynode
2
650
あなたの知らないPDFのアクセシビリティ
lycorptech_jp
PRO
0
200
Socrates × Looker 〜セマンティックレイヤーで進化するデータ分析エージェント〜
hanon52_
3
2.5k
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.4k
SONiCの統計情報を取得したい
sonic
0
190
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
1.2k
LLMにもCAP定理があるという話
harukasakihara
0
390
Android の公式 Skill / Android skills
yanzm
0
150
「エンジニア進化論」2028年の開発完全自動化、エンジニアはどう進化するか
cyberagentdevelopers
PRO
6
5.3k
小さくはじめるSLI/SLO ~育てながら組織に定着させる実践知~ / Starting Small with SLI/SLOs: Building Adoption Through Continuous Growth
nari_ex
7
2k
Bedrock AgentCore RuntimeでAuth0 Changelog調査AIをアップグレードした話
t5u8a5a
1
170
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Building the Perfect Custom Keyboard
takai
2
800
Documentation Writing (for coders)
carmenintech
77
5.4k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Into the Great Unknown - MozCon
thekraken
41
2.6k
The Spectacular Lies of Maps
axbom
PRO
1
810
Visualization
eitanlees
152
17k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
160
Scaling GitHub
holman
464
140k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
220
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
Transcript
Reactjs yhsiang @ MOSUTxTainan.py 8/23 Sat.
Who am I?
〳腋僽㔔捀し➮㣖랔✫
HWꅾ䏞♳涗罏 将虋䊨玑䌌
React
MVC but V
templates but components
update DOM reconciliation
Features
Virtual DOM also render on server-side
Data Flow one-way reactive data
JSX XML-like syntax
var HelloMessage = React.createClass({ render: function({ return <div>Hello {this.props.name}</div>; });
}); React.renderComponent( <HelloMessage name="John" />, mountNode);
var HelloMessage = React.createClass({ render: function({ return ! }); });
React.renderComponent( , mountNode); React.DOM.div(null, “Hello “, this.props.name); HelloMessage({name: “John”})
React+LiveScript
{div} = React.DOM HelloMessage = React.createClass do render: -> div
{}, “Hello #{@props.name}” React.renderComponent ( HelloMessage name: ‘John’), mountNode
A stateful component
{div} = React.DOM Timer = React.createClass do getInitialState: -> secondsElapsed:
0 tick: -> @setState secondsElapsed: @state.secondsElapsed + 1 componentDidMount: -> @interval = setInterval @tick, 1000 componentWillUnmount: -> clearInterval @interval render: -> div {}, “Seconds Elapsed: #{@state.secondsElapsed}” React.renderComponent Timer!, mountNode
props vs state external v.s. internal
Lifecyle
componentWillMount() componentDidMount() componentWillReceiveProps() Mounting Updating this.getDOMnode(), setTimeout, xhr shouldComponentUpdate() componentWillUpdate()
componentDidUpdate() Unmounting componentWillUnmount()
{div} = React.DOM Timer = React.createClass do getInitialState: -> secondsElapsed:
0 tick: -> @setState secondsElapsed: @state.secondsElapsed + 1 componentDidMount: -> @interval = setInterval @tick, 1000 componentWillUnmount: -> clearInterval @interval render: -> div {}, “Seconds Elapsed: #{@state.secondsElapsed}” React.renderComponent Timer!, mountNode
React-boostrap
More? propTypes, mixins, statics
Flux application architecture
unidirectional data flow
Action Controller Model View Model Model Model Model View View
View View
Action Dispatcher Store View Action
https://github.com/facebook/flux
callbacks waitFor
Action Dispatcher action = type: ‘NEW_THREAD’ to: ‘hychen’ text: ‘嗨懂’
threadID: ‘78123’ messageID: ‘1234’ Message Store Thread Store Message View Thread View ‘78123’: participants: <[ hychen ly ]> messageList: <[ 1234 ]>
Action Dispatcher action = type: ‘NEW_THREAD’ to: ‘hychen’ text: ‘嗨懂’
threadID: ‘78123’ messageID: ‘1234’ Message Store Thread Store Message View Thread View ‘1234’: text: ‘嗨懂’ thread: ‘78123’ author: ‘ly’
flux, fluxxor, fluxy
reactjs.tw on Facebook @lyforever
CC-BY 4.0