본문 바로가기
TroubleShooting

[ Emotion ] props 넘겨줄 때 타입 에러

by ウリ김영은 2023. 12. 16.

Type '{ children: Element[]; isMobile: boolean; }' is not assignable to type 'IntrinsicAttributes & { theme?: Theme | undefined; as?: ElementType<any> | undefined; } & ClassAttributes<HTMLDivElement> & HTMLAttributes<...>'.
// styles.ts

export const AboutProfileContainer = styled.div`
    display: flex;
    flex-direction: ${props => (props.isMobile ? 'column-reverse' : 'row')};
`
// styles.ts
export const AboutProfileContainer = styled.div<{isMobile:boolean}>`
    display: flex;
    flex-direction: ${props => (props.isMobile ? 'column-reverse' : 'row')};
`

참조
https://choonse.com/2022/08/07/1419/