SlideShare a Scribd company logo
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
presentation
PDF
Pfnp slides
PDF
[Web开发Css系列].Apress.Pro.Css.Techniques.Nov.2006
PDF
JavaScript 设计模式
PDF
CSS INTRODUCTION SLIDES WITH HTML CODE.pdf
PPT
CSS előfeldolgozók
PDF
Professional Css
PDF
Wsu css-cheat-sheet
PPT
Css best practices style guide and tips
PPT
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
PDF
Big Design Conference: CSS3
PPTX
CSS Walktrough Internship Course
PPTX
Lecture-7.pptx
PDF
Introduction to CSS3
PDF
Accelerated Stylesheets
PPTX
GDG On Campus NBNSCOE Web Workshop Day 1 : HTML & CSS
PPT
Css Founder.com | Cssfounder Company
PPT
Css Founder.com | Cssfounder Company
PPT
Basic css
PDF
Organize Your Website With Advanced CSS Tricks
presentation
Pfnp slides
[Web开发Css系列].Apress.Pro.Css.Techniques.Nov.2006
JavaScript 设计模式
CSS INTRODUCTION SLIDES WITH HTML CODE.pdf
CSS előfeldolgozók
Professional Css
Wsu css-cheat-sheet
Css best practices style guide and tips
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Big Design Conference: CSS3
CSS Walktrough Internship Course
Lecture-7.pptx
Introduction to CSS3
Accelerated Stylesheets
GDG On Campus NBNSCOE Web Workshop Day 1 : HTML & CSS
Css Founder.com | Cssfounder Company
Css Founder.com | Cssfounder Company
Basic css
Organize Your Website With Advanced CSS Tricks

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPT
Mechanical Engineering MATERIALS Selection
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Geodesy 1.pptx...............................................
PPTX
Sustainable Sites - Green Building Construction
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPT
Project quality management in manufacturing
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
DOCX
573137875-Attendance-Management-System-original
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
additive manufacturing of ss316l using mig welding
PDF
composite construction of structures.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
R24 SURVEYING LAB MANUAL for civil enggi
Foundation to blockchain - A guide to Blockchain Tech
Mechanical Engineering MATERIALS Selection
Operating System & Kernel Study Guide-1 - converted.pdf
Geodesy 1.pptx...............................................
Sustainable Sites - Green Building Construction
Automation-in-Manufacturing-Chapter-Introduction.pdf
Project quality management in manufacturing
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
CH1 Production IntroductoryConcepts.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
573137875-Attendance-Management-System-original
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
UNIT 4 Total Quality Management .pptx
additive manufacturing of ss316l using mig welding
composite construction of structures.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Internet of Things (IOT) - A guide to understanding

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