개발일지/Error

[Warning] Type '{'--box-gap: string;}' has no properties in common with type 'Properties<string | number, string & {}>'.

zineeworld 2023. 11. 30. 13:28
반응형

리액트 컴포넌트에서 받은 숫자값을 CSS 변수로 지정하고 싶은데,

style={{'--box-gap': `${gap}`px}​

 

이렇게 넣으니, Warning이 떴다.

 

 

해결책은 as React.CSSProperties를 넣어주면 된다.

style={{'--box-gap': `${gap}`px} as React.CSSProperties}

 

반응형