Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

JOE SEIFI @joeseifi

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Today’s Plan

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

COMPONENT REACT CSS

Slide 14

Slide 14 text

COMPONENT REACT

Slide 15

Slide 15 text

CSS…

Slide 16

Slide 16 text

GOOD

Slide 17

Slide 17 text

Familiarity GOOD

Slide 18

Slide 18 text

Familiarity Matured browser support GOOD From caniuse.com

Slide 19

Slide 19 text

Familiarity Matured browser support Continuous growth GOOD

Slide 20

Slide 20 text

Familiarity Matured browser support Continuous growth GOOD BAD Naming

Slide 21

Slide 21 text

Familiarity Matured browser support Continuous growth GOOD BAD Naming Not DRY

Slide 22

Slide 22 text

Familiarity Matured browser support Continuous growth GOOD BAD Naming Not DRY Developer Experience

Slide 23

Slide 23 text

Familiarity Matured browser support Continuous growth GOOD BAD Naming Not DRY Developer Experience DOM updates require JS

Slide 24

Slide 24 text

Familiarity Matured browser support Continuous growth GOOD BAD Naming Not DRY Developer Experience DOM updates require JS UGLY Globals

Slide 25

Slide 25 text

Familiarity Matured browser support Continuous growth GOOD BAD Naming Not DRY Developer Experience DOM updates require JS UGLY Globals Cascades

Slide 26

Slide 26 text

Familiarity Matured browser support Continuous growth GOOD BAD Naming Not DRY Developer Experience DOM updates require JS UGLY Globals Cascades Specificity

Slide 27

Slide 27 text

Familiarity Matured browser support Continuous growth GOOD BAD Naming Not DRY Developer Experience DOM updates require JS UGLY Globals Cascades Specificity Source Order

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

React with CSS Loader

Slide 35

Slide 35 text

.btn btn:hover btn.depressed React with CSS Loader

Slide 36

Slide 36 text

React with CSS Loader

Slide 37

Slide 37 text

React with CSS Loader

Slide 38

Slide 38 text

React with CSS Loader

Slide 39

Slide 39 text

React with CSS Loader

Slide 40

Slide 40 text

React with CSS Loader

Slide 41

Slide 41 text

React with CSS Loader

Slide 42

Slide 42 text

React with CSS Loader

Slide 43

Slide 43 text

React with CSS Loader

Slide 44

Slide 44 text

React with CSS Loader

Slide 45

Slide 45 text

React with CSS Loader

Slide 46

Slide 46 text

React with CSS Loader

Slide 47

Slide 47 text

React with CSS Loader

Slide 48

Slide 48 text

React with CSS Loader

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

React with Inline Styles

Slide 51

Slide 51 text

styles.btn :hover styles.btn.depressed React with Inline Styles

Slide 52

Slide 52 text

styles.btn :hover styles.btn.depressed React with Inline Styles

Slide 53

Slide 53 text

styles.btn :hover styles.btn.depressed React with Inline Styles

Slide 54

Slide 54 text

styles.btn :hover styles.btn.depressed React with Inline Styles

Slide 55

Slide 55 text

styles.btn :hover styles.btn.depressed X React with Inline Styles

Slide 56

Slide 56 text

React with Inline Styles

Slide 57

Slide 57 text

React with Inline Styles

Slide 58

Slide 58 text

React with Inline Styles

Slide 59

Slide 59 text

React with Inline Styles

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

Radium

Slide 62

Slide 62 text

css pseudo
 classes &
 elements
 :active :focus :hover Radium

Slide 63

Slide 63 text

: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

Slide 64

Slide 64 text

styles.btn ‘:hover’ styles.btn.depressed Radium

Slide 65

Slide 65 text

styles.btn ‘:hover’ styles.btn.depressed Radium

Slide 66

Slide 66 text

styles.btn ‘:hover’ styles.btn.depressed Radium

Slide 67

Slide 67 text

Radium

Slide 68

Slide 68 text

Radium

Slide 69

Slide 69 text

Radium

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

5,037

Slide 72

Slide 72 text

ShoppingCart.js VideoItem.js global.css Button.js button.css shopping-cart.css ShoppingCart.js VideoItem.js video-item.css button.js Separation of Concerns

Slide 73

Slide 73 text

ShoppingCart.js VideoItem.js global.css Button.js Languages button.css shopping-cart.css ShoppingCart.js VideoItem.js video-item.css button.js Separation of Concerns

Slide 74

Slide 74 text

ShoppingCart.js VideoItem.js global.css Button.js Languages Separation of Functionality button.css shopping-cart.css ShoppingCart.js VideoItem.js video-item.css button.js Separation of Concerns button.css button.js

Slide 75

Slide 75 text

ShoppingCart.js VideoItem.js global.css Button.js Languages Separation of Functionality button.css shopping-cart.css ShoppingCart.js VideoItem.js video-item.css button.js Separation of Concerns

Slide 76

Slide 76 text

ShoppingCart.js VideoItem.js global.css Button.js Languages Separation of Functionality ShoppingCart.js VideoItem.js button.js Separation of Concerns

Slide 77

Slide 77 text

Aphrodite

Slide 78

Slide 78 text

Regular Inline Styles Aphrodite

Slide 79

Slide 79 text

Regular Inline Styles Aphrodite Wraps Styles Object Aphrodite

Slide 80

Slide 80 text

Regular Inline Styles Aphrodite Wraps Styles Object Aphrodite

Slide 81

Slide 81 text

Rendered Regular Inline Styles Aphrodite Wraps Styles Object Aphrodite

Slide 82

Slide 82 text

Rendered Regular Inline Styles Aphrodite Wraps Styles Object Aphrodite

Slide 83

Slide 83 text

Rendered Regular Inline Styles Aphrodite Wraps Styles Object Aphrodite Output

Slide 84

Slide 84 text

Aphrodite

Slide 85

Slide 85 text

Aphrodite

Slide 86

Slide 86 text

Aphrodite

Slide 87

Slide 87 text

Aphrodite

Slide 88

Slide 88 text

5,037 2,627

Slide 89

Slide 89 text

React CSS Modules

Slide 90

Slide 90 text

React CSS Modules } Original .button CSS

Slide 91

Slide 91 text

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

Slide 92

Slide 92 text

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

Slide 93

Slide 93 text

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

Slide 94

Slide 94 text

React CSS Modules

Slide 95

Slide 95 text

React CSS Modules

Slide 96

Slide 96 text

React CSS Modules

Slide 97

Slide 97 text

React CSS Modules

Slide 98

Slide 98 text

React CSS Modules

Slide 99

Slide 99 text

React CSS Modules

Slide 100

Slide 100 text

React CSS Modules

Slide 101

Slide 101 text

React CSS Modules

Slide 102

Slide 102 text

React CSS Modules

Slide 103

Slide 103 text

5,037 2,627 3,414

Slide 104

Slide 104 text

Styletron

Slide 105

Slide 105 text

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

Slide 106

Slide 106 text

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

Slide 107

Slide 107 text

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

Slide 108

Slide 108 text

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 }

Slide 109

Slide 109 text

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 }

Slide 110

Slide 110 text

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 }

Slide 111

Slide 111 text

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”

Slide 112

Slide 112 text

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”

Slide 113

Slide 113 text

.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

Slide 114

Slide 114 text

.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

Slide 115

Slide 115 text

Styletron

Slide 116

Slide 116 text

Styletron

Slide 117

Slide 117 text

Styletron

Slide 118

Slide 118 text

5,037 2,627 3,414 1,472

Slide 119

Slide 119 text

Styled Components

Slide 120

Slide 120 text

JS HTML Element React Styled Components

Slide 121

Slide 121 text

HTML Element React Component React Styled Components

Slide 122

Slide 122 text

HTML Element Styles HTML Element React Component React Styled Components

Slide 123

Slide 123 text

HTML Element HTML Element Styled Component React Component React Styled Components

Slide 124

Slide 124 text

Styled Components Styles Element Styled Component

Slide 125

Slide 125 text

Styled Components Styles Element Element Styled Component

Slide 126

Slide 126 text

Styled Components Styles Element Styles Styled Component

Slide 127

Slide 127 text

Styled Components Styles Element Styles Styled Component StyledButton

Slide 128

Slide 128 text

Styled Components StyledButton

Slide 129

Slide 129 text

Styled Components Rendered StyledButton

Slide 130

Slide 130 text

Styled Components Output Rendered StyledButton

Slide 131

Slide 131 text

Styled Components Output Rendered StyledButton

Slide 132

Slide 132 text

Styled Components

Slide 133

Slide 133 text

5,037 2,627 3,414 1,472 5,174

Slide 134

Slide 134 text

CSS IN REACT
 
 Innovations
 Now & Future


Slide 135

Slide 135 text

CSS IN REACT
 
 Innovations
 Now & Future
 CSS3 Variables

Slide 136

Slide 136 text

CSS IN REACT
 
 Innovations
 Now & Future
 Typed CSS

Slide 137

Slide 137 text

CSS IN REACT
 
 Innovations
 Now & Future
 Web Components

Slide 138

Slide 138 text

CSS IN REACT
 
 Innovations
 Now & Future
 Vue.js & Scoped Styles

Slide 139

Slide 139 text

- 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. “ ”

Slide 140

Slide 140 text

Q&A @joeseifi • https://github.com/joeshub/css-in-react