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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Yuanhsiang Cheng
August 25, 2014
Technology
370
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
230
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
200
Other Decks in Technology
See All in Technology
作って理解するCoding Agent 〜フレームワークに頼らないピュア Python での実装〜
takapy
1
120
形式手法特論:Hyperproperty とモデル検査 #kernelvm / Kernel VM Study Tokyo 19th
ytaka23
0
290
My broken English still works: speaking at global OSS events
naruoga
0
120
AIに狂うスタートアップが、あえて「人との協働」に全振りした新卒エンジニア研修 / New Graduate Engineer Training at a Startup Accelerating AI Adoption
ohnoeight
0
160
LanceDB入門
mocobeta
9
630
三人寄ればチューリング完全
puhitaku
3
850
コーチングの奥義 何もしないテクニック
jinwatanabe
0
140
Genie Codeハンズオン応用編
taka_aki
0
130
Adding Right-to-Left support to your web application with CSS logical properties — Lessons from Redmine
vividtone
0
160
【GCC2026】TrueHDRIを用いたルックデブ環境とライティングテクニック
bandainamcostudios
PRO
0
130
Kiro Crew入門 - 常駐エージェントの仕組みと使いどころ / Intro to Kiro Crew
k_adachi_01
1
630
医療の現場を変革に挑戦した半年間の軌跡 - PythonとAIで現場を変える / From Code to Care
soudai
PRO
0
300
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
22k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
500
Designing for Timeless Needs
cassininazir
1
450
A designer walks into a library…
pauljervisheath
211
24k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Statistics for Hackers
jakevdp
799
230k
Ethics towards AI in product and experience design
skipperchong
2
350
RailsConf 2023
tenderlove
30
1.5k
Accessibility Awareness
sabderemane
1
180
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
3
460
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
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