axios2 리액트 Fetch API 와 axios 를 통해 서버와 통신하기 Fetch API 와 axios 를 통해 서버와 통신하기 참고사이트 fetch const loadContent= () =>{ const url = 'api/todolist' const options={ method:"GET" } fetch(url,options) .then((resp)=>{ return resp.json() }) .then( data => { console.log(JSON.stringify(data)) setListContent(data) }) } axios 구형브라우저 지원 요청 중단 가능 응답 시간 초과 설정 가능 CSRF 보호 기능 내장 JSON 데이터 자동변환 Node.js 에서 사용 npm install axios // api/todoinsert : 서버 url const han.. 2022. 6. 16. 리액트 Movie API를 활용한 영화 목록 사이트 react-router-dom 을 5버전대로 다운그레이드 npm install axios react-router-dom@5.2.0 bootstrap-bootstrap Link to 적용을 위해 index.js 에서 를 주석 처리 // // 네비게이션 Navigation.js import {Container, Nav, Navbar} from "react-bootstrap" import React from 'react'; const Navigation = () => { return ( Home MovieList About ); }; export default Navigation; Home MovieList About href 에 따라 링크 이동 Home.js import { useEffect, useStat.. 2022. 6. 7. 이전 1 다음