✏️기록하는 즐거움
반응형
article thumbnail
[React] style 적용 시 발생한 에러: The `style` prop expects a mapping from style properties to values, not a string.
Face-to-Error 2022. 7. 22. 13:29

| 에러 발생 과정 React에서 style object를 만들어서 컴포넌트 props로 전달하는 방법을 시도하고 있었다. 내가 원하는 조건일 경우 style object를 전달하려고 했을 때 해당 오류가 발생했다. | 에러 코드 function Square({ value, onClick, style }) { return ( {value} ); } class Board extends React.Component { renderSquare(i) { const isWinningIndex = this.props.winningIndex && this.props.winningIndex.indexOf(i) !== -1; const styleObj = { boxShadow: "0px 2px 8px 0px #FFC23..

반응형