SlideShare une entreprise Scribd logo
1  sur  22
I'm Andrii Los,
Frontend Engineer at ITV Project
👋
GitHub: RIP21 Twitter: @RIP212
💄CSS-in-JS 💅
Styling for component era web
💩 Problems of CSS
🤖 How they were addressed
💅 CSS-in-JS features
🤖♀️ CSS-in-JS F.A.Q and its problems 💩
🎉 Future of CSS-in-JS
Problems of CSS 💩
💩 Designed for documents not apps
💩 Globally scoped
💩 Hardly reusable
💩 Leaking
💩 Non-programmatic
💩 Non-modular
💩 CSS develops too slow
How they were addressed 🤖
🤖 LESS
🤖 PostCSS
🤖 SASS
🤖 Stylus
🤖 CSS Modules
🤖 All above with Webpack loaders and plugins
What problems were
preserved? 💩
💩 Non-modular out of the box
💩 Still not componentized enough
💩 Require a lot of class names manual work
💩 Still global and can leak
💩 Reusability still not perfect
So what if we would like to
fix them all in one ultimate
solution? 🤖
💄
Glorious
CSS-in-JS!
💅
CSS-in-JS
💅 styled-components
👩🎤 emotion
💄 glamorous
CSS rules definition
💅 Template string literals
💄 Object React inline-styles notation
👩🎤 Supports both
So what the possibilities?
🎉 Media queries
🎉 Keyframes
🎉 Pseudo classes
🎉 Nested selectors
🎉 It's JS, so you have all its power
🎉 Babel and Webpack optimisations for production
🎉 Total isolation if old global CSS approach is not used
🎉 Easy theming support
So what the possibilities?
🎉 Full interoperability with existent CSS
🎉 Inject global styles if you know what you are doing
🎉 Full support for styling 3rd parties components
🎉 Extend API for easily reuse styles
🎉 react-primitives - React Native, React Sketch, etc.
🎉 Endless of other powerful things that you can
come up with
Main features demo 🤖
What's the problems? 💩
💩 Weak editors support?! It's just strings and objects!
🎉 Nope! Webstorm, VS Code, Sublime Text, Atom support is there!
💩 Formatting! I sure it's just highlights the text, but no formatting!
🎉 Nope! Webstorm formats it perfectly. (Not sure about others though)
💩 Meh! Then I won't use!
🎉 Editors doesn't matter. Prettier is formatting CSS in template literals ;)
💩 But we don't use it!
🤖♀️ What's wrong with you?! It's amazing!
💩 I'm not impressed yet..... I need something. It's stupid to have CSS in JS!
🤷♀️ Okay, but what did you were saying about JSX a few years ago 🤖
💩 PERFORMANCE!
Well, you are a little correct 💩
💩 styled-components performance in unrealistic
benchmarks is very weak
🎉 Good news. Emotion and glamorous have bench
performance only 5-10% slower than CSS Modules
🎉 Real world apps performance is good for all
solutions
🎉 There is a hacks to improve it even further if so
needed
So, what you would
recommend?
styled-components 💅
Why?
💅 11000 stars on GitHub, means lots of contributions
💅 Supports React Native and other renderers
💅 Amazing Jest and other test runners support
💅 A lot of tooling is already done for it
💅 Stylelint support (works for emotion as well)
💅 The best documentation
💅 Better performance - matter of time
Future of CSS-in-JS
🤖 ISTF - Interoperable Style Transfer
Format (Even further performance
improvement, CSS-in-JS styles interop)
🤷 Extreme styles optimisations to reduce
amount of CSS code up to 30-60%
(depends on codebase size)
That's all folks! 👋
GitHub: RIP21 Twitter: @RIP212
List of links and resources 🔗
• Sandbox for this speech
• A unified styled language @markdalgleish - MUST READ (pick on
CSS-in-JS by co-author of CSS Modules)
• styled-components documentation
• emotion documentation and full of perf demos of emotion in its
authors twitter
• glamorous documentation
• Amazing article about styled-components future and CSS-in-JS in
overall by one of the authors of s-c
• Template string literals or Object notations, what to choose? Read
that

Contenu connexe

Tendances

My Top 10 Secret Weapons for Frontend Development
My Top 10 Secret Weapons for Frontend DevelopmentMy Top 10 Secret Weapons for Frontend Development
My Top 10 Secret Weapons for Frontend DevelopmentGeoffrey Plitt
 
귀 Rails의 JS는 안녕하십니까?
귀 Rails의 JS는 안녕하십니까?귀 Rails의 JS는 안녕하십니까?
귀 Rails의 JS는 안녕하십니까?Cheon Park
 
Gulp.js & webpack
Gulp.js & webpackGulp.js & webpack
Gulp.js & webpackTed Hsu
 
React JS for the mobile web
React JS for the mobile webReact JS for the mobile web
React JS for the mobile webSreten Madžgalj
 
End-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptEnd-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptGil Fink
 
Why you should build your own JS Frontend Framework
Why you should build your own JS Frontend FrameworkWhy you should build your own JS Frontend Framework
Why you should build your own JS Frontend Frameworkbaccigalupi
 
Clojure Lightning Talk
Clojure Lightning TalkClojure Lightning Talk
Clojure Lightning TalkGiltTech
 
Web Development: Making it the right way
Web Development: Making it the right wayWeb Development: Making it the right way
Web Development: Making it the right wayYagiz Nizipli
 

Tendances (11)

My Top 10 Secret Weapons for Frontend Development
My Top 10 Secret Weapons for Frontend DevelopmentMy Top 10 Secret Weapons for Frontend Development
My Top 10 Secret Weapons for Frontend Development
 
귀 Rails의 JS는 안녕하십니까?
귀 Rails의 JS는 안녕하십니까?귀 Rails의 JS는 안녕하십니까?
귀 Rails의 JS는 안녕하십니까?
 
Anti anti patterns
Anti anti patternsAnti anti patterns
Anti anti patterns
 
Gulp.js & webpack
Gulp.js & webpackGulp.js & webpack
Gulp.js & webpack
 
React JS for the mobile web
React JS for the mobile webReact JS for the mobile web
React JS for the mobile web
 
End-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptEnd-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScript
 
Java sutra
Java sutraJava sutra
Java sutra
 
Why you should build your own JS Frontend Framework
Why you should build your own JS Frontend FrameworkWhy you should build your own JS Frontend Framework
Why you should build your own JS Frontend Framework
 
Clojure Lightning Talk
Clojure Lightning TalkClojure Lightning Talk
Clojure Lightning Talk
 
Web Development: Making it the right way
Web Development: Making it the right wayWeb Development: Making it the right way
Web Development: Making it the right way
 
Javascript toolkit
Javascript toolkitJavascript toolkit
Javascript toolkit
 

Similaire à CSS-in-JS in React: Why, current state, and bright future.

OOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsOOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsNetguru
 
A journey from sass to css in-js
A journey from sass to css in-jsA journey from sass to css in-js
A journey from sass to css in-jsMartin Jujou
 
Reworking our-workflows
Reworking our-workflowsReworking our-workflows
Reworking our-workflowsnolly00
 
Exploring Our Front-End Workflows
Exploring Our Front-End WorkflowsExploring Our Front-End Workflows
Exploring Our Front-End Workflowsnolly00
 
CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3 CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3 Jeffrey Barke
 
Not Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS frameworkNot Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS frameworkcrystalenka
 
Leveling up your JavaScipt - DrupalJam 2017
Leveling up your JavaScipt - DrupalJam 2017Leveling up your JavaScipt - DrupalJam 2017
Leveling up your JavaScipt - DrupalJam 2017Christian Heilmann
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applicationsVittorio Vittori
 
Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4Derek Jacoby
 
The World of Stylesheet Languages
The World of Stylesheet LanguagesThe World of Stylesheet Languages
The World of Stylesheet LanguagesAndrea Tino
 
Angular vs React - Devoxx BE 2017
Angular vs React - Devoxx BE 2017Angular vs React - Devoxx BE 2017
Angular vs React - Devoxx BE 2017Deepu K Sasidharan
 
Is everything we used to do wrong?
Is everything we used to do wrong?Is everything we used to do wrong?
Is everything we used to do wrong?Russ Weakley
 
CSS Best Practices
CSS Best PracticesCSS Best Practices
CSS Best Practicesnolly00
 
Planning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teamsPlanning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teamsChristian Heilmann
 
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!Evan Mullins
 
Bootstrap for Beginners
Bootstrap for BeginnersBootstrap for Beginners
Bootstrap for BeginnersD'arce Hess
 
Вредные советы .NET разработчикам, Сергей Калинец
Вредные советы .NET разработчикам, Сергей КалинецВредные советы .NET разработчикам, Сергей Калинец
Вредные советы .NET разработчикам, Сергей КалинецSigma Software
 
Java 8 - Gateway Drug or End of Line?
Java 8 - Gateway Drug or End of Line?Java 8 - Gateway Drug or End of Line?
Java 8 - Gateway Drug or End of Line?Garth Gilmour
 
Going native with html5 web components
Going native with html5 web componentsGoing native with html5 web components
Going native with html5 web componentsJames York
 

Similaire à CSS-in-JS in React: Why, current state, and bright future. (20)

OOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsOOScss Architecture For Rails Apps
OOScss Architecture For Rails Apps
 
A journey from sass to css in-js
A journey from sass to css in-jsA journey from sass to css in-js
A journey from sass to css in-js
 
Reworking our-workflows
Reworking our-workflowsReworking our-workflows
Reworking our-workflows
 
Exploring Our Front-End Workflows
Exploring Our Front-End WorkflowsExploring Our Front-End Workflows
Exploring Our Front-End Workflows
 
CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3 CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3
 
Not Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS frameworkNot Just a Pretty Face: How to design and build a cross-CMS CSS framework
Not Just a Pretty Face: How to design and build a cross-CMS CSS framework
 
Leveling up your JavaScipt - DrupalJam 2017
Leveling up your JavaScipt - DrupalJam 2017Leveling up your JavaScipt - DrupalJam 2017
Leveling up your JavaScipt - DrupalJam 2017
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applications
 
Enhance Enhance
Enhance EnhanceEnhance Enhance
Enhance Enhance
 
Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4
 
The World of Stylesheet Languages
The World of Stylesheet LanguagesThe World of Stylesheet Languages
The World of Stylesheet Languages
 
Angular vs React - Devoxx BE 2017
Angular vs React - Devoxx BE 2017Angular vs React - Devoxx BE 2017
Angular vs React - Devoxx BE 2017
 
Is everything we used to do wrong?
Is everything we used to do wrong?Is everything we used to do wrong?
Is everything we used to do wrong?
 
CSS Best Practices
CSS Best PracticesCSS Best Practices
CSS Best Practices
 
Planning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teamsPlanning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teams
 
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
WordCamp Asheville 2017 - So You Wanna Dev? Join the Team!
 
Bootstrap for Beginners
Bootstrap for BeginnersBootstrap for Beginners
Bootstrap for Beginners
 
Вредные советы .NET разработчикам, Сергей Калинец
Вредные советы .NET разработчикам, Сергей КалинецВредные советы .NET разработчикам, Сергей Калинец
Вредные советы .NET разработчикам, Сергей Калинец
 
Java 8 - Gateway Drug or End of Line?
Java 8 - Gateway Drug or End of Line?Java 8 - Gateway Drug or End of Line?
Java 8 - Gateway Drug or End of Line?
 
Going native with html5 web components
Going native with html5 web componentsGoing native with html5 web components
Going native with html5 web components
 

Dernier

Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 

Dernier (20)

Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 

CSS-in-JS in React: Why, current state, and bright future.

  • 1. I'm Andrii Los, Frontend Engineer at ITV Project 👋 GitHub: RIP21 Twitter: @RIP212
  • 2. 💄CSS-in-JS 💅 Styling for component era web
  • 3. 💩 Problems of CSS 🤖 How they were addressed 💅 CSS-in-JS features 🤖♀️ CSS-in-JS F.A.Q and its problems 💩 🎉 Future of CSS-in-JS
  • 4. Problems of CSS 💩 💩 Designed for documents not apps 💩 Globally scoped 💩 Hardly reusable 💩 Leaking 💩 Non-programmatic 💩 Non-modular 💩 CSS develops too slow
  • 5. How they were addressed 🤖 🤖 LESS 🤖 PostCSS 🤖 SASS 🤖 Stylus 🤖 CSS Modules 🤖 All above with Webpack loaders and plugins
  • 6. What problems were preserved? 💩 💩 Non-modular out of the box 💩 Still not componentized enough 💩 Require a lot of class names manual work 💩 Still global and can leak 💩 Reusability still not perfect
  • 7. So what if we would like to fix them all in one ultimate solution? 🤖
  • 10. CSS rules definition 💅 Template string literals 💄 Object React inline-styles notation 👩🎤 Supports both
  • 11. So what the possibilities? 🎉 Media queries 🎉 Keyframes 🎉 Pseudo classes 🎉 Nested selectors 🎉 It's JS, so you have all its power 🎉 Babel and Webpack optimisations for production 🎉 Total isolation if old global CSS approach is not used 🎉 Easy theming support
  • 12. So what the possibilities? 🎉 Full interoperability with existent CSS 🎉 Inject global styles if you know what you are doing 🎉 Full support for styling 3rd parties components 🎉 Extend API for easily reuse styles 🎉 react-primitives - React Native, React Sketch, etc. 🎉 Endless of other powerful things that you can come up with
  • 15. 💩 Weak editors support?! It's just strings and objects! 🎉 Nope! Webstorm, VS Code, Sublime Text, Atom support is there! 💩 Formatting! I sure it's just highlights the text, but no formatting! 🎉 Nope! Webstorm formats it perfectly. (Not sure about others though) 💩 Meh! Then I won't use! 🎉 Editors doesn't matter. Prettier is formatting CSS in template literals ;) 💩 But we don't use it! 🤖♀️ What's wrong with you?! It's amazing! 💩 I'm not impressed yet..... I need something. It's stupid to have CSS in JS! 🤷♀️ Okay, but what did you were saying about JSX a few years ago 🤖 💩 PERFORMANCE!
  • 16. Well, you are a little correct 💩 💩 styled-components performance in unrealistic benchmarks is very weak 🎉 Good news. Emotion and glamorous have bench performance only 5-10% slower than CSS Modules 🎉 Real world apps performance is good for all solutions 🎉 There is a hacks to improve it even further if so needed
  • 17. So, what you would recommend? styled-components 💅
  • 18. Why? 💅 11000 stars on GitHub, means lots of contributions 💅 Supports React Native and other renderers 💅 Amazing Jest and other test runners support 💅 A lot of tooling is already done for it 💅 Stylelint support (works for emotion as well) 💅 The best documentation 💅 Better performance - matter of time
  • 19. Future of CSS-in-JS 🤖 ISTF - Interoperable Style Transfer Format (Even further performance improvement, CSS-in-JS styles interop) 🤷 Extreme styles optimisations to reduce amount of CSS code up to 30-60% (depends on codebase size)
  • 20.
  • 21. That's all folks! 👋 GitHub: RIP21 Twitter: @RIP212
  • 22. List of links and resources 🔗 • Sandbox for this speech • A unified styled language @markdalgleish - MUST READ (pick on CSS-in-JS by co-author of CSS Modules) • styled-components documentation • emotion documentation and full of perf demos of emotion in its authors twitter • glamorous documentation • Amazing article about styled-components future and CSS-in-JS in overall by one of the authors of s-c • Template string literals or Object notations, what to choose? Read that