Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Data driven rendering
Search
Marc Tamlyn
February 17, 2016
Technology
1
190
Data driven rendering
An introduction to ReactJS given at JSOxford
Marc Tamlyn
February 17, 2016
Tweet
Share
More Decks by Marc Tamlyn
See All by Marc Tamlyn
Arousal and Anxiety
mjtamlyn
1
81
Working with Children
mjtamlyn
1
91
Wallingford Castle Archers Incorporation
mjtamlyn
0
200
Observation and Evaluation
mjtamlyn
0
130
Weird and Wonderful things to do with the ORM
mjtamlyn
3
1.4k
An Introduction to Graphene and Relay
mjtamlyn
6
1.2k
Tech Interviews that don't suck
mjtamlyn
4
1.1k
What's new in Django 1.9
mjtamlyn
1
210
Django Development Milestones
mjtamlyn
1
180
Other Decks in Technology
See All in Technology
年間40件以上の登壇を続けて見えた「本当の発信力」/ 20251213 Masaki Okuda
shift_evolve
PRO
1
140
mairuでつくるクレデンシャルレス開発環境 / Credential-less development environment using Mailru
mirakui
5
570
たまに起きる外部サービスの障害に備えたり備えなかったりする話
egmc
0
330
AWS CLIの新しい認証情報設定方法aws loginコマンドの実態
wkm2
7
770
通勤手当申請チェックエージェント開発のリアル
whisaiyo
3
250
特別捜査官等研修会
nomizone
0
200
プロンプトやエージェントを自動的に作る方法
shibuiwilliam
15
15k
チーリンについて
hirotomotaguchi
6
2.1k
AIプラットフォームにおけるMLflowの利用について
lycorptech_jp
PRO
1
180
障害対応訓練、その前に
coconala_engineer
0
140
AIBuildersDay_track_A_iidaxs
iidaxs
3
410
AI駆動開発における設計思想 認知負荷を下げるフロントエンドアーキテクチャ/ 20251211 Teppei Hanai
shift_evolve
PRO
2
440
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
432
66k
Documentation Writing (for coders)
carmenintech
77
5.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
23
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
2
2.7k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.4k
Six Lessons from altMBA
skipperchong
29
4.1k
What's in a price? How to price your products and services
michaelherold
246
13k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
75
Designing for Timeless Needs
cassininazir
0
86
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
390
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