Lesson 43 of 50
cssCSS‑in‑JS (Styled‑Components, Emotion)
9 mins
Course progress86%
What you'll learn
Keep this idea in mind as you work through the lesson.
Lesson 43 of 50
css9 mins
Keep this idea in mind as you work through the lesson.
Write CSS inside JavaScript, enabling props‑driven styling.
import styled from 'styled-components';
const Button = styled.button`
background:${props => props.primary ? '#0066cc' : '#ccc'};
color:#fff; padding:0.5rem 1rem;
`;
ThemeProvider.