작성
·
284
1
ERROR in ./src/chapter_03/Library.jsx 5:0-24
Module not found: Error: Can't resolve 'Book' in '/../my-react1/src/chapter_03'
Did you mean './Book'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules, /../my-react1/node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
어떻게 해야 할까요?
답변 3
1
0
네, 아래와 같습니다.
import React from "react";
import Book from 'Book';
function Library(props){
return(
<div>
<Book name="처음 만난 파이썬" numOfPage={300} />
<Book name="처음 만난 AWS" numOfPage={400} />
<Book name="처음 만난 리액트" numOfPage={500} />
</div>
);
}
export default Library;
0
Book.jsx
파일을 같은 폴더에 작성하셨는지는 모르겠는데,만약
Library.jsx
파일과 같은 경로에 작성했다면 아래와 같이import
하셔야 합니다.