5. props와 attrs
Keyword
1. props
// Tagged templates은 함수로 파싱할 수 있어 아래와 같이 함수 표현식 사용이 가능하다는 점을 이용한다.
import styled, { css } from 'styled-components';
type ParagraphProps = {
active?: boolean;
}
const Paragraph = styled.p<ParagraphProps>`
color: ${(props) => (props.active ? '#F00' : '#888')};
${(props) => props.active && css`
font-weight: bold;
`}
`;2. attrs
Last updated