Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Responsive D3 The React Way
Search
John Bartos
March 16, 2016
Programming
0
210
Responsive D3 The React Way
Use higher-order components to abstract the nastiness of interacting with the real DOM
John Bartos
March 16, 2016
Tweet
Share
Other Decks in Programming
See All in Programming
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
140
実はマルチモーダルだった。ブラウザの組み込みAI🧠でWebの未来を感じてみよう #jsfes #gemini
n0bisuke2
3
1.2k
開発に寄りそう自動テストの実現
goyoki
2
1.2k
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
360
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
130
Go コードベースの構成と AI コンテキスト定義
andpad
0
130
【CA.ai #3】ワークフローから見直すAIエージェント — 必要な場面と“選ばない”判断
satoaoaka
0
260
從冷知識到漏洞,你不懂的 Web,駭客懂 - Huli @ WebConf Taiwan 2025
aszx87410
2
2.7k
認証・認可の基本を学ぼう前編
kouyuume
0
260
関数実行の裏側では何が起きているのか?
minop1205
1
710
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.9k
sbt 2
xuwei_k
0
300
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
3.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Tell your own story through comics
letsgokoyo
0
740
ラッコキーワード サービス紹介資料
rakko
0
1.7M
Become a Pro
speakerdeck
PRO
31
5.7k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
310
The Cult of Friendly URLs
andyhume
79
6.7k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Bash Introduction
62gerente
615
210k
Embracing the Ebb and Flow
colly
88
4.9k
30 Presentation Tips
portentint
PRO
1
160
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
740
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)