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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
1.6k
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
3
1.7k
Seven New Principles of Software Engineering
yegor256
0
470
Spec-Driven Development - Why Vaadin Is the Perfect Fit
simas
PRO
0
240
SODA - FACT BOOK(JP)
sodainc
1
40k
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
310
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
180
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
630
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
160
Moscow Python Meetup №112. Как поселить ИИ агентов в event driven архитектуре
moscowdjango
PRO
0
110
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.4k
Coding with AI: How to trust the storyteller (AWS Community Day Adria, Ljubljana 2026)
slobodan
0
140
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
630
Crafting Experiences
bethany
1
430
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
310
WCS-LA-2024
lcolladotor
0
980
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Code Review Best Practice
trishagee
74
20k
How to train your dragon (web standard)
notwaldorf
96
6.9k
The SEO identity crisis: Don't let AI make you average
varn
0
630
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
530
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)