Scikit Web

Error: The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX. 본문

ReactJS

Error: The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.

Keun0 2023. 2. 28. 20:44
728x90
반응형

Error: The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.

 

html tag 중 react style 과 맞지 않아 생기는 오류 이다.

<div 
  className="progress-bar bg-danger"
  role="progressbar"
  style="width: 20%"
  aria-valuenow="20"
  aria-valuemin="0"
  aria-valuemax="100"
  ></div>

위와 같은 코드를 아래와 같이 react 에서 권장하는 방법으로 변경하여 해결

<div 
  className="progress-bar bg-danger"
  role="progressbar"
  style={{width: "20%"}}
  aria-valuenow="20"
  aria-valuemin="0"
  aria-valuemax="100"
  ></div>

 

728x90
반응형

'ReactJS' 카테고리의 다른 글

MUI Step UI Custom example  (0) 2023.01.12
Javascript Fetch Promise All Request 예제  (0) 2022.11.01
NextJS i18N with Use Router  (0) 2022.08.01
ReactJS 리액트 Custom Hook 만들기 예제  (0) 2022.06.30
Comments