πŸ‡ΊπŸ‡¦ STOP WAR IN UKRAINE πŸ‡ΊπŸ‡¦
Avatar

Emotion

Media Queries

✏️ Edit this page

Using media queries in emotion works just like using media queries in regular css except you don't have to specify a selector inside the block, you can put your css directly in the css block.

(Edit code to see changes)

Reusable Media Queries

Media queries can be useful to create responsive apps but repeating them is annoying and can lead to inconsistencies. Instead of rewriting them each time you use them, you can move them into constants and refer to the variable each time you want to use them like this.

(Edit code to see changes)

facepaint

While defining media queries in constants is much easier than rewriting media queries each time, they're still quite verbose since you usually want to change the same property at different breakpoints. facepaint makes this easier by allowing you to define what each css property should be at each media query as an array.

Note:

facepaint only works with object styles.

yarn add facepaint
# or if you use npm
npm install --save facepaint
(Edit code to see changes)