인프런 커뮤니티 질문&답변

장진웅님의 프로필 이미지

작성한 질문수

처음 만난 리액트(React)

(실습) 시계 만들기

시간 index.js 오류가 나요 ㅠ

24.07.18 20:35 작성

·

156

0

import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; //import App from './App'; //import reportWebVitals from './reportWebVitals'; import Clock from './chapter_04/clock'; const root = ReactDOM.createRoot(document.getElementById('root')); setInterval(() => { root.render( <React.StrictMode> <Clock /> </React.StrictMode> ); }, 1000);import React from "react"; const Clock = () => { return( <div> <h1>안녕, 리엑스</h1> <h2>현재 시간: {new Date().toLocaleTimeString}</h2> </div> ) } export default Clock;Failed to compile. Module not found: Error: Can't resolve './chapter_03/Library' in 'C:\reactdeveloper\reactcoding\my-app\src' WARNING in [eslint] src\index.js Line 4:8: 'App' is defined but never used no-unused-vars Line 5:8: 'reportWebVitals' is defined but never used no-unused-vars Line 7:8: 'Library' is defined but never used no-unused-vars Failed to compile. Module not found: Error: Can't resolve './chapter_03/Library' in 'C:\reactdeveloper\reactcoding\my-app\src' WARNING in [eslint] src\index.js Line 4:8: 'App' is defined but never used no-unused-vars Line 5:8: 'reportWebVitals' is defined but never used no-unused-vars Line 7:8: 'Library' is defined but never used no-unused-vars Failed to compile. Module not found: Error: Cannot find file: 'clock.jsx' does not match the corresponding name on disk: '.\src\chapter_04\Clock.jsx'. ERROR in ./src/index.js 10:0-39 Module not found: Error: Cannot find file: 'clock.jsx' does not match the corresponding name on disk: '.\src\chapter_04\Clock.jsx'. webpack compiled with 1 error이렇게 오류가 나고 있는데 해결 방법이 있을까요

답변 1

0

Inje Lee (소플)님의 프로필 이미지
Inje Lee (소플)
지식공유자

2024. 07. 18. 20:40

안녕하세요, 소플입니다.

 

현재 로그 상으로는 import한 파일 경로가 잘못된 것 같은데 다시 한 번 경로를 한 번 확인해보시기 바랍니다.

그리고 VS Code 화면이나 에러 로그가 발생하는 브라우저의 콘솔 로그 등을 캡처해서 첨부해 주시면 더 정확한 답변을 드릴 수 있을 것 같습니다.

 

감사합니다.