기본문법
const Button = styled.button`
background-color: ${(props) => (props.danger ? "red" : "blue")};
border-radius: 50px;
&:focus {
outline: none;
}
`;createGlobalStyle
import { createGlobalStyle } from "styled-components";
const GlobalStyle = createGlobalStyle`
html {
color: red;
}
`;
export default function App() {
return (
<div>
<GlobalStyle />
This is my app!
</div>
);
}mixin, extend, Extra Attribute
theme
styled-components 동작 방식
CSS-in-JS(styled-components) 사용 시 장점
Last updated