Ajax axios, Redux

React.js 2018. 2. 25. 23:26


React에서 ajax기능을 사용할때는 axios HttpClient를 많이 사용한다.   REF



  axios.get('/user?id=velopert')

    .then( response => { console.log(response); } ) // SUCCESS
    .catch( response => { console.log(response); } ); // ERROR

axios.post('/msg', { user: 'velopert', message: 'hi' }) .then( response => { console.log(response) } ) .catch( response => { console.log(response) } ); //catch는 생략가능

//IE 호환문제 ? babe-polyfill로 해결? -> test해보자.

class 활용 예제. 

https://laracasts.com/discuss/channels/servers/get-data-out-from-axios-javascript



Redux 는 study중:    dispatcher방식으로 state관리  https://velopert.com/1225   




=================물론 jquery $.ajax도 사용할 수 있다 =================


 (POST앞에 있는것은 커서임)


출처:유투브



Posted by yongary
,