Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Data driven rendering
Search
Marc Tamlyn
February 17, 2016
Technology
230
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Data driven rendering
An introduction to ReactJS given at JSOxford
Marc Tamlyn
February 17, 2016
More Decks by Marc Tamlyn
See All by Marc Tamlyn
Arousal and Anxiety
mjtamlyn
1
140
Working with Children
mjtamlyn
1
130
Wallingford Castle Archers Incorporation
mjtamlyn
0
260
Observation and Evaluation
mjtamlyn
0
170
Weird and Wonderful things to do with the ORM
mjtamlyn
3
1.5k
An Introduction to Graphene and Relay
mjtamlyn
6
1.3k
Tech Interviews that don't suck
mjtamlyn
4
1.2k
What's new in Django 1.9
mjtamlyn
1
240
Django Development Milestones
mjtamlyn
1
210
Other Decks in Technology
See All in Technology
How we choose session proposals
kawaguti
PRO
0
170
CSS2026:OWS研究会・招待講演「世界観を、実装する」
atsush1_sada
2
340
構造で守らせる データ・法務・セキュリティ・開発チームとつくる AI時代のデータガバナンスとデータ基盤のリアル
legalontechnologies
PRO
1
530
AI時代のGraphQL
joere
3
410
LLM-as-a-Judgeは本当に信頼できるのか――評価器を評価する話
taka_aki
3
1.1k
200人の配信コメント、 全部Jevが仕分けます 〜 マサカリガードを作ってみた 〜
katayamatg
0
130
VLA-JEPA: Enhancing Vision-Language-Action Models with Latent World Models
takmin
0
330
DevelopersIO 2026 Tokyo 現時点の衛星通信サービスの現状を整理してみる
maroon1st
0
310
【データ横丁主催】AI エージェント時代のTranslytical Data Platform
shisyu_gaku
0
300
撮るだけでは終わらない。ソニーが挑むB2Bカメラソリューション開発
sony
0
110
dbt Semantic Layerで進めるenechainのデータ民主化
akizhou
1
270
ポケモン対戦を自動で記録して振り返ろう
fufufukakaka
0
410
Featured
See All Featured
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
67k
Ethics towards AI in product and experience design
skipperchong
2
440
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
470
Mobile First: as difficult as doing things right
swwweet
225
10k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
790
Designing Experiences People Love
moore
143
24k
Testing 201, or: Great Expectations
jmmastey
46
8.4k
Thoughts on Productivity
jonyablonski
76
5.4k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
650
Faster Mobile Websites
deanohume
310
32k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
500
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Transcript
Data driven rendering An introduction to ReactJS Marc Tamlyn Photo
by Konstans Zafeiri on photocrowd.com
None
This is not •Babel •Webpack •Browserify •Flux •Redux •Relay
Motivation
None
Motivation •Responsive to input changes •Interactivity •Rendering only •Not a
jQuery mess!
What is React? •View layer of a traditional MVC •Virtual
DOM •Single directional data flow
What is a Component? •Takes input (props) •Returns an element
•Class with a render() method
What is a Component? var Photo = React.createClass({ render: function()
{ return React.createElement('img', { src: this.props.imageSrc, }); } });
Components with children var Photos = React.createClass({ render: function() {
var photos = this.props.photos.map((photo) => { return React.createElement(Photo, { imageSrc: photo.imageSrc, }); }); return React.createElement('div', {}, photos); } });
JSX •Preprocessor for React.createElement() •Compile using your JS preprocessor of
choice
JSX var Photos = React.createClass({ render: function() { var photos
= this.props.photos.map((photo) => { return <Photo imageSrc={photo.imageSrc} /> }); return <div>{photos}</div>; } });
Virtual DOM •Renders in memory-light virtual DOM •Compares changes between
trees •Flushes only changes to the document •Debounces rendering
Data flow •Components have state as well as props •Minimise
use of state •Handle at top level and pass functions around •Handle externally altogether!
Data flow var Photos = React.createClass({ getInitialState: function() { return
{photos: this.props.photos}; }, onLove: function() { … }, render: function() { var photos = this.state.photos.map((photo) => { return <Photo imageSrc={photo.imageSrc} onLove={this.onLove} /> }); return <div>{photos}</div>; } });
Data flow var Photo = React.createClass({ render: function() { return
<div> <img src={this.props.imageSrc} /> <a onclick={this.props.onLove}>Love</a> </div>; } });
Data flow •YOUR CHOICE •External communication
Example time!
$.fn.reactify <div data-react-component="Photos" data-react-props="{{ photos_json }}"></div> <script> $(document).reactify(); </script>
Work with us photocrowd.com/jobs
Thank you github.com/mjtamlyn twitter.com/mjtamlyn photocrowd.com/mjtamlyn