▼비동기통신 Axios 사용방법 (GET, POST, DELETE, FETCH)▼ [리액트 심화] 비동기통신 Axios 사용방법 (GET, POST, DELETE, FETCH) 1. GET: 데이터 조회 import { useEffect, useState } from 'react'; import './App.css'; import axios from 'axios'; function App() { const [todos, setTodos] = useState(null); const [inputValue, setInpuValue] = useState({ //id : json의 방식의 데이터 zerotonine2da.tistory.com 1. Axios란? - Promise 기반 HTTP 통신 가능한 라이브러..
(1) HTTP 통신 - 개념 : 데이터로 이루어진 communication ( 웹서버 - 웹브라우저 : 서버 - 클라이언트) - (약속 = 프로토콜) - HTTP 프로토콜 = 웹에서 서버와 클라이언트의 상호간 약속 (2) Request (요청) Response(응답) (3) URL 구성 (4) 메서드 (client -> server) GET - 조회 POST - 생성 PUT, PATCH - 변경 DELETE - 삭제 [참고] HTTP request methods - HTTP | MDN HTTP defines a set of request methods to indicate the desired action to be performed for a given resource. Although they ca..
1. json-server란? - 아주 간단한 DB와 API 서버를 생성해주는 패키지 - 임시적으로 사용할 mock data 생성 위함 (테스트용) 2. json-server 사용하기 (1) vs 코드 터미널 : json-server 추가 yarn add json-server (2) src - db.json 파일 생성 [db.json] { "posts": [{ "id": 1, "title": "json-server", "author": "typicode" }], "comments": [{ "id": 1, "body": "some comment", "postId": 1 }], "profile": { "name": "typicode" } } ▶ key 부분이 쌍따옴표여서 json임 (3) JSON serve..
1. 리덕스 툴킷이란? - 리덕스를 개량한 것 => 리덕스의 구조와 패러다임은 동일 (새로운 개념 x) - 차이 : 설정 부분 & 모듈 파일! 2. 리덕스 툴킷 설치 방법 (1) 터미널에 yarn으로 추가하기 yarn add @reduxjs/toolkit 3. 코드 비교 (1) configStore.js 비교 [일반 리덕스] import { createStore } from "redux"; import { combineReducers } from "redux"; import counter from "../modules/counter"; const rootReducer = combineReducers({ counter, }); const store = createStore(rootReducer); expo..