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
Responsive D3 The React Way
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
John Bartos
March 16, 2016
Programming
210
0
Share
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
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
340
KMP × Kotlin 2.3 - How Android Got Slower While iOS Builds Improved by 47%
rio432
0
170
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
1
700
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
2.8k
Spec Driven Development | AI Summit Vilnius
danielsogl
PRO
1
150
From Formal Specification to Property Based Test
ohbarye
0
2.4k
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
200
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
400
AgentCore Optimizationを始めよう!
licux
3
230
Programming with a DJ Controller — not vibe coding
m_seki
3
820
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
380
20260514_its_the_context_window_stupid.pdf
heita
0
910
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Navigating Team Friction
lara
192
16k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Raft: Consensus for Rubyists
vanstee
141
7.4k
Documentation Writing (for coders)
carmenintech
77
5.3k
How to build a perfect <img>
jonoalderson
1
5.5k
Deep Space Network (abreviated)
tonyrice
0
130
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.4k
Context Engineering - Making Every Token Count
addyosmani
9
880
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.4k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
820
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)