강의

멘토링

로드맵

Inflearn Community Q&A

blueskyfog5201's profile image
blueskyfog5201

asked

Learning React A-Z by Following Along [Version 19 반영]

Creating an image banner

axios.js 에 인스턴스를 만든 후 Banner.js 에 import 할 때 문의

Written on

·

572

1

안녕하세요!

axios.js 에 인스턴스를 만들고 그 인스턴스를

export default instance; 로 export 해줬는데

그렇다면 Banner.js 에서 가져와서 사용할 때

import instance from "../api/axios"; 라고 가져와서

instance.get(requests.fetchNowPlaying);

이런 식으로 사용하는게 맞지 않나 생각이 들어서 질문 드립니다.

 

reactreduxtddtypescriptnext.js

Quiz

What is the main reason an API key is needed when using an external service's API?

Data Sorting

Request Authentication and Identification

UI Design Change

App speedup

Answer 1

0

John Ahn님의 프로필 이미지
John Ahn
Instructor

안녕하세요!

default로 export를 해주었을 때는 어떠한 이름을 사용하든 괜찮습니다!

하지만 default로 export를 해주지 않았을 때는 정확히 같은 이름으로 {} 중괄호를 사용해서 import를 해주셔야 합니다.

감사합니다.

blueskyfog5201's profile image
blueskyfog5201

asked

Ask a question