CSS in React - The Good, The Bad, and The Ugly
JOE SEIFI
@joeseifi
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The Ugly
Today’s Plan
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The Ugly
COMPONENT
REACT
CSS
COMPONENT
REACT
CSS…
GOOD
FamiliarityGOOD
Familiarity
Matured browser support
GOOD
From caniuse.com
Familiarity
Matured browser support
Continuous growth
GOOD
Familiarity
Matured browser support
Continuous growth
GOOD
BAD Naming
Familiarity
Matured browser support
Continuous growth
GOOD
BAD Naming
Not DRY
Familiarity
Matured browser support
Continuous growth
GOOD
BAD Naming
Not DRY
Developer Experience
Familiarity
Matured browser support
Continuous growth
GOOD
BAD Naming
Not DRY
Developer Experience
DOM updates require JS
Familiarity
Matured browser support
Continuous growth
GOOD
BAD Naming
Not DRY
Developer Experience
DOM updates require JS
UGLY Globals
Familiarity
Matured browser support
Continuous growth
GOOD
BAD Naming
Not DRY
Developer Experience
DOM updates require JS
UGLY Globals
Cascades
Familiarity
Matured browser support
Continuous growth
GOOD
BAD Naming
Not DRY
Developer Experience
DOM updates require JS
UGLY Globals
Cascades
Specificity
Familiarity
Matured browser support
Continuous growth
GOOD
BAD Naming
Not DRY
Developer Experience
DOM updates require JS
UGLY Globals
Cascades
Specificity
Source Order
BAD Naming
Not DRY
Developer Experience
DOM updates require JS
Familiarity
Matured browser support
Continuous growth
GOOD
UGLY Globals
Cascades
Specificity
Source Order
IDEAL FEATURES 

FOR CSS IN REACT FRAMEWORKS
BAD Naming
Not DRY
Developer Experience
DOM updates require JS
Familiarity
Matured browser support
Continuous growth
GOOD
UGLY Globals
Cascades
Specificity
Source Order
IDEAL FEATURES 

FOR CSS IN REACT FRAMEWORKS
Components with local CSS
Optional global CSS
BAD Naming
Not DRY
Developer Experience
DOM updates require JS
Familiarity
Matured browser support
Continuous growth
GOOD
UGLY Globals
Cascades
Specificity
Source Order
Full CSS support
Server side rendering / Extract CSS
IDEAL FEATURES 

FOR CSS IN REACT FRAMEWORKS
Components with local CSS
Optional global CSS
BAD Naming
Not DRY
Developer Experience
DOM updates require JS
Familiarity
Matured browser support
Continuous growth
GOOD
UGLY Globals
Cascades
Specificity
Source Order
Full CSS support
Server side rendering / Extract CSS
No dead CSS
Themes
Debugging in DevTools
Linting & syntax highlighting
Automatic vendor prefixing
IDEAL FEATURES 

FOR CSS IN REACT FRAMEWORKS
Components with local CSS
Optional global CSS
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The Ugly
React with CSS Loader
.btn
btn:hover
btn.depressed
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
React with CSS Loader
CSS in React - The Good, The Bad, and The Ugly
React with Inline Styles
styles.btn
:hover
styles.btn.depressed
React with Inline Styles
styles.btn
:hover
styles.btn.depressed
React with Inline Styles
styles.btn
:hover
styles.btn.depressed
React with Inline Styles
styles.btn
:hover
styles.btn.depressed
React with Inline Styles
styles.btn
:hover
styles.btn.depressed
X
React with Inline Styles
React with Inline Styles
React with Inline Styles
React with Inline Styles
React with Inline Styles
CSS in React - The Good, The Bad, and The Ugly
Radium
css pseudo

classes &

elements

:active
:focus
:hover
Radium
:any
:checked
:default
:dir()
:disabled
:empty
:enabled
:first
:first-child
:first-of-type
:fullscreen
:indeterminate
:in-range
:invalid
:lang()
:last-child
:last-of-type
:left
:link
:not()
:nth-child()
:nth-last-child()
:nth-last-of-type()
:nth-of-type()
:only-child
:only-of-type
:optional
:out-of-range
:read-only
:read-write
:required
:right
:root
:scope
:target
:valid
:visited

::after
::before
::first-letter
::first-line
::selection
::backdrop
::placeholder
::marker
::spelling-error
::grammar-error
css pseudo

classes &

elements

:active
:focus
:hover
Radium
styles.btn
‘:hover’
styles.btn.depressed
Radium
styles.btn
‘:hover’
styles.btn.depressed
Radium
styles.btn
‘:hover’
styles.btn.depressed
Radium
Radium
Radium
Radium
CSS in React - The Good, The Bad, and The Ugly
5,037
ShoppingCart.js
VideoItem.js
global.css
Button.js
button.css
shopping-cart.cssShoppingCart.js
VideoItem.js video-item.css
button.js
Separation of Concerns
ShoppingCart.js
VideoItem.js
global.css
Button.js
Languages
button.css
shopping-cart.cssShoppingCart.js
VideoItem.js video-item.css
button.js
Separation of Concerns
ShoppingCart.js
VideoItem.js
global.css
Button.js
Languages Separation of Functionality
button.css
shopping-cart.cssShoppingCart.js
VideoItem.js video-item.css
button.js
Separation of Concerns
button.cssbutton.js
ShoppingCart.js
VideoItem.js
global.css
Button.js
Languages Separation of Functionality
button.css
shopping-cart.cssShoppingCart.js
VideoItem.js video-item.css
button.js
Separation of Concerns
ShoppingCart.js
VideoItem.js
global.css
Button.js
Languages Separation of Functionality
ShoppingCart.js
VideoItem.js
button.js
Separation of Concerns
Aphrodite
Regular Inline Styles
Aphrodite
Regular Inline Styles Aphrodite Wraps Styles Object
Aphrodite
Regular Inline Styles Aphrodite Wraps Styles Object
Aphrodite
Rendered
Regular Inline Styles Aphrodite Wraps Styles Object
Aphrodite
Rendered
Regular Inline Styles Aphrodite Wraps Styles Object
Aphrodite
Rendered
Regular Inline Styles Aphrodite Wraps Styles Object
Aphrodite
Output
Aphrodite
Aphrodite
Aphrodite
Aphrodite
5,037
2,627
React CSS Modules
React CSS Modules
}
Original .button CSS
.button_btn_18iwj {
}
{

btn: “button_btn_18iwj”
}
Generated CSS
JS maps classnames
React CSS Modules
}
Original .button CSS
.button_btn_18iwj {
}
{

btn: “button_btn_18iwj”
}
Generated CSS
JS maps classnames
React CSS Modules
}
Original .button CSS
.button_btn_18iwj {
}
{

btn: “button_btn_18iwj”
}
Generated CSS
JS maps classnames
React CSS Modules
}
Original .button CSS
React CSS Modules
React CSS Modules
React CSS Modules
React CSS Modules
React CSS Modules
React CSS Modules
React CSS Modules
React CSS Modules
React CSS Modules
5,037
2,627
3,414
Styletron
Styletron
Source style objects
Generated CSS
{

color: ‘#ec4800’
font: ‘bold 32px’
}
Styletron
Source style objects
Generated CSS
{

font: ‘bold 32px’
text-align: ‘center’
}
{

color: ‘#ec4800’
font: ‘bold 32px’
}
Styletron
Source style objects
Generated CSS
{

font: ‘bold 32px’
text-align: ‘center’
}
{

color: ‘#ec4800’
font: ‘bold 32px’
}
{

text-align: ‘center’
color: ‘#ec4800’
}
Styletron
Source style objects
Generated CSS
{

font: ‘bold 32px’
text-align: ‘center’
}
{

color: ‘#ec4800’
font: ‘bold 32px’
}
{

text-align: ‘center’
color: ‘#ec4800’
}


.a { color: #ec4800 }
.b { font: bold 32px }
.c { text-align: center }
Styletron
Source style objects
Generated CSS
{

font: ‘bold 32px’
text-align: ‘center’
}
{

color: ‘#ec4800’
font: ‘bold 32px’
}
{

text-align: ‘center’
color: ‘#ec4800’
}


.a { color: #ec4800 }
.b { font: bold 32px }
.c { text-align: center }
Styletron
Source style objects
Generated CSS
{

font: ‘bold 32px’
text-align: ‘center’
}
{

color: ‘#ec4800’
font: ‘bold 32px’
}
{

text-align: ‘center’
color: ‘#ec4800’
}


.a { color: #ec4800 }
.b { font: bold 32px }
.c { text-align: center }
Styletron
Source style objects
Generated CSS
{

font: ‘bold 32px’
text-align: ‘center’
}
{

color: ‘#ec4800’
font: ‘bold 32px’
}
{

text-align: ‘center’
color: ‘#ec4800’
}


.a { color: #ec4800 }
.b { font: bold 32px }
.c { text-align: center }


“a b”
“b c”
“b a”
Styletron
Source style objects
Generated CSS
6 Rules
3 Rules
{

font: ‘bold 32px’
text-align: ‘center’
}
{

color: ‘#ec4800’
font: ‘bold 32px’
}
{

text-align: ‘center’
color: ‘#ec4800’
}


.a { color: #ec4800 }
.b { font: bold 32px }
.c { text-align: center }


“a b”
“b c”
“b a”
.a
.b
.c
.d
.e
.f
.g
.h
.i
.j
.l
.btn
.btn:hover
.btn.depressed
Styletron
.a .b .c .d .e .f .g .h .i .j .j .k .l
.l:hover
.m .n .o
.a
.b
.c
.d
.e
.f
.g
.h
.i
.j
.l
.btn
.btn:hover
.btn.depressed
Styletron
.a .b .c .d .e .f .g .h .i .j .j .k .l
.l:hover
.m .n .o
Styletron
Styletron
Styletron
5,037
2,627
3,414
1,472
Styled Components
JS
HTML
Element
React Styled Components
HTML
Element
React Component
React Styled Components
HTML
Element
Styles
HTML
Element
React Component
React Styled Components
HTML
Element
HTML
ElementStyled ComponentReact Component
React Styled Components
Styled Components
StylesElement
Styled Component
Styled Components
StylesElementElement
Styled Component
Styled Components
StylesElement Styles
Styled Component
Styled Components
StylesElement Styles
Styled Component
StyledButton
Styled Components
StyledButton
Styled Components
Rendered
StyledButton
Styled Components
Output
Rendered
StyledButton
Styled Components
Output
Rendered
StyledButton
Styled Components
5,037
2,627
3,414
1,472
5,174
CSS IN REACT



Innovations

Now & Future

CSS IN REACT



Innovations

Now & Future

CSS3 Variables
CSS IN REACT



Innovations

Now & Future

Typed CSS
CSS IN REACT



Innovations

Now & Future

Web
Components
CSS IN REACT



Innovations

Now & Future

Vue.js &
Scoped Styles
- Bret Victor
Technology changes quickly, people’s minds change
slowly. So it’s easy to adopt new technologies, it can be
hard to adopt new ways of thinking.
“
”
Q&A
@joeseifi • https://github.com/joeshub/css-in-react

More Related Content

PDF
CSS in React
PDF
Responsive Websites
PDF
LESS
PDF
CSS3: Ripe and Ready to Respond
PDF
CSS3: Simply Responsive
PDF
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
PDF
Intro to CSS3
PPTX
From PSD to WordPress Theme: Bringing designs to life
CSS in React
Responsive Websites
LESS
CSS3: Ripe and Ready to Respond
CSS3: Simply Responsive
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Intro to CSS3
From PSD to WordPress Theme: Bringing designs to life

What's hot (20)

PDF
Whirlwind Tour of SVG (plus RaphaelJS)
PDF
CSS3 Media Queries
PDF
Quality Development with CSS3
PDF
CSS3: Are you experienced?
PPTX
PDF
Introduction to CSS3
PDF
PPT
Html & Css presentation
PDF
Html standards presentation
PDF
Beyond CSS Architecture
PDF
モダンなCSS設計パターンを考える
PDF
Fundamental JQuery
PDF
[Worskhop Summits] CSS3 Workshop
PDF
Bootstrap Workout 2015
PPTX
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
PPTX
Rapid and Responsive - UX to Prototype with Bootstrap
PDF
How to use CSS3 in WordPress
PDF
jQuery UI and Plugins
PDF
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
PDF
CSSプリプロセッサの取扱説明書
Whirlwind Tour of SVG (plus RaphaelJS)
CSS3 Media Queries
Quality Development with CSS3
CSS3: Are you experienced?
Introduction to CSS3
Html & Css presentation
Html standards presentation
Beyond CSS Architecture
モダンなCSS設計パターンを考える
Fundamental JQuery
[Worskhop Summits] CSS3 Workshop
Bootstrap Workout 2015
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
Rapid and Responsive - UX to Prototype with Bootstrap
How to use CSS3 in WordPress
jQuery UI and Plugins
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
CSSプリプロセッサの取扱説明書
Ad

Viewers also liked (20)

PDF
Supporting Bodily Communication in Video Consultations of Physiotherapy
PDF
Healthy Breakfast Ideas for Kids
PPTX
Ebt centec
PPTX
Aula 4 estrutura literária - lucas 18. 18-30
PDF
Ley de titulos_valores
PDF
2017 circular 1ª ronda liga nacional cadete v.1
PPTX
Kablosuz ağlar
PPTX
Base de datos 2 trabajo 3
PPTX
Ganesh murti nagar.
PPTX
CONNEXTWorking Oct 2016 - Job interview
PPTX
Logica proposicional
PDF
Photogrammetry for Games
PDF
What have i learnt from target audience feedback
PPTX
Delito Informático
PDF
Revista Mujer Patria Roja Marzo 2017
PDF
PDF
GlobalDSL 2013 - Models, Representations, Animations : The Eclipse Sirius Pro...
DOCX
Fairy tales 2
PPTX
Quack Chat: Diving into Data Governance
DOCX
Taller 4 - procesos internos
Supporting Bodily Communication in Video Consultations of Physiotherapy
Healthy Breakfast Ideas for Kids
Ebt centec
Aula 4 estrutura literária - lucas 18. 18-30
Ley de titulos_valores
2017 circular 1ª ronda liga nacional cadete v.1
Kablosuz ağlar
Base de datos 2 trabajo 3
Ganesh murti nagar.
CONNEXTWorking Oct 2016 - Job interview
Logica proposicional
Photogrammetry for Games
What have i learnt from target audience feedback
Delito Informático
Revista Mujer Patria Roja Marzo 2017
GlobalDSL 2013 - Models, Representations, Animations : The Eclipse Sirius Pro...
Fairy tales 2
Quack Chat: Diving into Data Governance
Taller 4 - procesos internos
Ad

Similar to CSS in React - The Good, The Bad, and The Ugly (20)

PDF
9- Learn CSS Fundamentals / Pseudo-classes
PDF
Introduction to Responsive Web Design
PDF
presentation
PPT
css Cascading Style Sheets (CSS) - control the look and feel of your HTML doc...
PDF
CSS3 - is everything we used to do wrong?
PDF
Critical Rendering Path
PDF
새로운 웹 스타일링, 안 본 사람 없게 해주세요
PDF
11- Learn CSS Fundamentals / Combinators
PDF
Getting Started with Sass & Compass
PPT
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
PPT
css1.ppt
PDF
Accelerated Stylesheets
PPTX
David Weliver
KEY
Sass Essentials at Mobile Camp LA
PDF
The Future State of Layout
PDF
How to use CSS3 in WordPress - Sacramento
KEY
HTML CSS & Javascript
PPT
KEY
HTML5 and CSS3 for Teachers
PPTX
Css for Development
9- Learn CSS Fundamentals / Pseudo-classes
Introduction to Responsive Web Design
presentation
css Cascading Style Sheets (CSS) - control the look and feel of your HTML doc...
CSS3 - is everything we used to do wrong?
Critical Rendering Path
새로운 웹 스타일링, 안 본 사람 없게 해주세요
11- Learn CSS Fundamentals / Combinators
Getting Started with Sass & Compass
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
css1.ppt
Accelerated Stylesheets
David Weliver
Sass Essentials at Mobile Camp LA
The Future State of Layout
How to use CSS3 in WordPress - Sacramento
HTML CSS & Javascript
HTML5 and CSS3 for Teachers
Css for Development

Recently uploaded (20)

PPTX
Electric vehicle very important for detailed information.pptx
PPTX
22ME926Introduction to Business Intelligence and Analytics, Advanced Integrat...
DOCX
web lab manual for fifth semester BE course fifth semester vtu belgaum
PDF
Design and Implementation of Low-Cost Electric Vehicles (EVs) Supercharger: A...
PPTX
Unit I - Mechatronics.pptx presentation
PPTX
RA-UNIT-1.pptx ( Randomized Algorithms)
PDF
Human CELLS and structure in Anatomy and human physiology
PDF
The Journal of Finance - July 1993 - JENSEN - The Modern Industrial Revolutio...
PDF
CB Công Nghiệp Slide .dh bách khoa đà nẵng
PDF
IoT-Based Hybrid Renewable Energy System.pdf
PPTX
sinteringn kjfnvkjdfvkdfnoeneornvoirjoinsonosjf).pptx
PPTX
240409 Data Center Training Programs by Uptime Institute (Drafting).pptx
PDF
Recent Trends in Network Security - 2025
PPTX
Module 1 – Introduction to Computer Networks: Foundations of Data Communicati...
PDF
BBC NW_Tech Facilities_30 Odd Yrs Ago [J].pdf
PPTX
MODULE 3 SUSTAINABLE DEVELOPMENT GOALSPPT.pptx
PPTX
Ingredients of concrete technology .pptx
PDF
ITEC 1010 - Networks and Cloud Computing
PPTX
MODULE 02 - CLOUD COMPUTING-Virtual Machines and Virtualization of Clusters a...
PDF
COMPARATIVE ANALYSIS REPORT BY NDIDIAMAKA .G. ISRAEL
Electric vehicle very important for detailed information.pptx
22ME926Introduction to Business Intelligence and Analytics, Advanced Integrat...
web lab manual for fifth semester BE course fifth semester vtu belgaum
Design and Implementation of Low-Cost Electric Vehicles (EVs) Supercharger: A...
Unit I - Mechatronics.pptx presentation
RA-UNIT-1.pptx ( Randomized Algorithms)
Human CELLS and structure in Anatomy and human physiology
The Journal of Finance - July 1993 - JENSEN - The Modern Industrial Revolutio...
CB Công Nghiệp Slide .dh bách khoa đà nẵng
IoT-Based Hybrid Renewable Energy System.pdf
sinteringn kjfnvkjdfvkdfnoeneornvoirjoinsonosjf).pptx
240409 Data Center Training Programs by Uptime Institute (Drafting).pptx
Recent Trends in Network Security - 2025
Module 1 – Introduction to Computer Networks: Foundations of Data Communicati...
BBC NW_Tech Facilities_30 Odd Yrs Ago [J].pdf
MODULE 3 SUSTAINABLE DEVELOPMENT GOALSPPT.pptx
Ingredients of concrete technology .pptx
ITEC 1010 - Networks and Cloud Computing
MODULE 02 - CLOUD COMPUTING-Virtual Machines and Virtualization of Clusters a...
COMPARATIVE ANALYSIS REPORT BY NDIDIAMAKA .G. ISRAEL

CSS in React - The Good, The Bad, and The Ugly