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 Components with ReactJS
Search
David Badura
March 21, 2017
Technology
230
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Responsive Components with ReactJS
https://github.com/DavidBadura/react-responsive-components-slides
David Badura
March 21, 2017
More Decks by David Badura
See All by David Badura
Exploring Projections and Processors in Event Sourcing
davidbadura
0
57
phpitfalls - cologne
davidbadura
0
190
PostCSS Mythbusting
davidbadura
1
230
Other Decks in Technology
See All in Technology
range over func 2年間の軌跡 Issue #56413 はGoのエコシステムをどう変えたか
ryujicre8ive
0
110
[2026-09-11]SREは誰のもの?運用エンジニアが始める 「SRE領域への越境」とチームの進化の軌跡 〜Road to NEXT CRE
tosite
0
160
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
560
WAF 運用改善の承認サイクル/SRE_BizReach_MIXI_1
visional_engineering_and_design
2
600
Tab5をRubyで動くパソコンにする
kishima
2
350
From Vanilla Kubernetes to a Batteries-Included Platform: Developer Experience at 1,300+ Clusters
yosshi_
0
700
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
110
SQL文一行も書けない人事がCortexもろもろを使って人事業務を楽にしてみる
ponponmikankan
1
220
AI活用の現在地、 ちゃんと見えてますか?/XPfest-2026
visional_engineering_and_design
0
210
安心して変更できるWebフロントエンドの作り方
pirosikick
4
1.7k
クロスボーダーM&AのValue Upを支えるプロダクト開発。日米チームのハブになったプロダクトエンジニアの実践 / Product Engineering Conference 2026
genda
0
120
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
150
Featured
See All Featured
KATA
mclloyd
PRO
35
15k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
4
630
We Are The Robots
honzajavorek
0
360
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
Abbi's Birthday
coloredviolet
3
9.9k
From π to Pie charts
rasagy
0
360
Utilizing Notion as your number one productivity tool
mfonobong
4
590
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
820
The Cult of Friendly URLs
andyhume
79
7k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
Transcript
with ReactJS <RESPONSIVE-COMPONENTS/>
DAVID BADURA Software Developer @ i22 Digitalagentur GmbH Loves ReactJS,
Symfony & Simplicity
WHAT IS REACTJS?
SKIP PLEASE
WHAT WE WANT?
1) ENCAPSULATED COMPONENTS
2) RESPONSIVE LAYOUTS
WE WANT MORE Performance Simplicity Pizza ...
BUT FOCUS ON
WHAT WE HAVE?
MEDIA QUERY .image { height: 200px; } @media (min-width: 500px)
{ .image { width: 200px; float: left; } } @media (min-width: 600px) { .top .image { width: 200px; float: left; } .image { width: 280px; float: none; } }
None
None
None
ENCAPSULATED? not really
WHAT WE REALLY WANT?
ENCAPSULATED RESPONSIVE COMPONENTS
CONTAINER QUERY .image { height: 200px; } .item:media(min-width: 460px) {
.image { width: 200px; float: left; } }
CONTAINER QUERY Container queries allow an author to control styling
based on the size of a containing element rather than the size of the user ’s viewport. - Container Queries - Editor’s Draft, 5 June 2015
NO SUPPORT IN ANY BROWSER
None
MAGIC!
import React from "react"; import {applyContainerQuery} from "react-container-query" ; import
classnames from 'classnames'; const query = { 'width-between-400-and-599' : { minWidth: 400, maxWidth: 599 }, 'width-larger-than-600' : { minWidth: 600, } }; export default applyContainerQuery(class extends React.Component { render() { return ( <div classNames={classnames(this.props.containerQuery)}> // ... </div> ); } }, query);
HOW? Never ask questions you don't want to known the
answers to
import React from "react"; import {applyContainerQuery} from "react-container-query" ; import
Slider from "./Slider"; import Grid from "./Grid"; export default applyContainerQuery(class Content extends React.Component { render() { return ( <div> {this.props.containerQuery.small ? <Slider data={this.props.data} /> : <Grid data={this.props.data} />} </div> ); } }, { 'small': { maxWidth: 599 } });
BUT HOW?
REACT-CONTAINER-QUERY Modular responsive component. With dependency on...
ELEMENT-RESIZE-DETECTOR Super-optimized cross-browser resize listener for elements.
!!! WARNING !!! For information on risks and side-effects please
read the documentaion and ask your doctor or pharmacist.
None
BUT IT WORKS! And it's super fast!
THIS FEATURE IS COMING SOON ... in one or two
years ... maybe ...
RESIZEOBSERVER ResizeObserver allows you to be notified when an element’s
content rectangle has changed its size, and react accordingly. (ResizeObserver is in Chrome 54)
const ro = new ResizeObserver( entries => { for (let
entry of entries) { const cr = entry.contentRect; console.log('Element:', entry.target); console.log(`Element size: ${cr.width}px x ${cr.height}px`); console.log(`Element padding: ${cr.top}px ; ${cr.left}px`); } }); // Observe one or multiple elements ro.observe(someElement);
QUESTIONS?
@DavidBadura
#bonn-devs https://slackinvite.me/to/bonn-devs
REFERENCES http://responsiveimagescg.github.io/container-queries https://tomhodgins.github.io/element-queries-spec/element-queries.html https://developers.google.com/web/updates/2016/10/resizeobserver https://www.sitepoint.com/responsive-web-components https://github.com/wnr/element-resize-detector https://github.com/d6u/react-container-query https://www.i22.de/
<THANKS!/>