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
Responsive D3 The React Way
Search
John Bartos
March 16, 2016
Programming
220
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Responsive D3 The React Way
Use higher-order components to abstract the nastiness of interacting with the real DOM
John Bartos
March 16, 2016
Other Decks in Programming
See All in Programming
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
110
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.4k
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
130
自分的「カンファレンスの楽しみ方」
syumai
0
200
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
160
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
480
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
640
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
FastAPI の並行処理モデルを完全に理解する
hoto17296
9
3.8k
Family mrubyの進捗
kishima
1
100
XP祭りでしか伝わらないフリップネタ #xpjug
murabayashi
0
110
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
270
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
A designer walks into a library…
pauljervisheath
211
25k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
230
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.7k
Believing is Seeing
oripsolob
1
210
Transcript
Making D3 Responsive The React Way https://johnbartos.github.io/react-d3-demo/ johnbartos.io
I'm John Bartos, and this is my first talk ever
You want to make sweet D3 visualizations that just work™
on all screen sizes (you also care about doing it properly)
But there's a problem...
D3 needs to know its size before runtime You don't
know size until runtime
Fortunately, there's an easy solution
ReactDOM.findDOMNode() GetBoundingClientRect() window.addEventListener('resize', ..) this.setState()
But there are two (2) things wrong with this approach!
findDOMNode() breaks component abstraction
A stateless component is now stateful
You need a higher-order component! (?)
HOCs are functions which take a component and returns another
component that wraps it (thats it)
Our HOC gets size exactly as before and passes it
as props to its child When 'resize' event fires, new props are passed, prompting a rerender
The HOC encapsulates all the nastiness
The wrapped component just gets props
There's a small catch – children render before parents Need
to set initial state in HOC
(Please clap)