리액트,자바스크립트

Axios,Fetch

JUN0126 2020. 3. 2. 01:25

RestFull

1)Axios

axios는 HTTP 클라이언트 라이브러리로써, 비동기 방식으로 HTTP 데이터 요청을 실행합니다.
내부적으로 AXIOS는 직접적으로 XMLHttpRequest 를 다루지 않고 “AJAX 호출”을 할 수 있습니다.

axios("API 주소") {

method : "GET,POST,PUT,DELETE"

setTime : 4000 (로딩시간)

}

.then( res => {                            // 정보의 값이 들어가 있다

 this.setState({

   state 값 : res.data

  })

})

.catch(err =>

{

this.setState({

errMsg : err 머시기 

})

}

 

2)Fetch

 

'리액트,자바스크립트' 카테고리의 다른 글

React-redux.md  (0) 2020.07.05
React 상태관리 (Context, Redux)  (0) 2020.06.16
React Hooks -1  (0) 2020.06.05
React (Component Life Cycle)  (0) 2020.03.01
React 기초 (Component, Props, State)  (0) 2020.03.01