728x90
1. 이미지를 src 하위 디렉토리로 이동
2. 이미지 사용시 require를 이용해 변수 선언한 뒤 사용하기
const ComponentExample = () => {
let logo = require("../imgs/logo.png");
return (
<div>
<img src={logo}/>
</div>
)
}
'Javascript Tips' 카테고리의 다른 글
react.js) index.html에 로고 에러나오는 현상 (0) | 2024.06.23 |
---|---|
react) ip숨김처리 문제로 node 서버가 안 켜지는 경우(Invalid options object. Dev Server has been initialized using an options object that does not match the API schema) (0) | 2024.06.20 |
react) vite + react 프로젝트 생성 (0) | 2024.04.23 |
vue3) router에서 데이터 넘기기 ($route.params 사용) (1) | 2024.03.15 |
vue) 로컬에서 빌드한 index.html 라우팅 안되는 현상 (0) | 2024.02.21 |