![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcdhwuQ%2FbtracJ2IN5r%2FOsK40l2J2e1SFpC5LcTYVK%2Fimg.png)
์ธ์ฆ ๋ฐฉ์ 1. API key๋ฅผ ํตํ ์ธ์ฆ ๊ณผ์ user๊ฐ login ์ ๋ณด๋ฅผ ์ ๋ ฅํ๋ค. Client๋ ์ด๋ฏธ Server์ ๋ฑ๋กํ API key๋ฅผ ๊ฐ์ง๊ณ ์๋ค. Client๋ user๊ฐ ์ ๋ ฅํ Login ์ ๋ณด๋ฅผ ๋ฐ์์ API key์ ํจ๊ป Login API๋ฅผ ์์ฒญํ๋ค. Server๋ API key๋ฅผ ํตํด ํด๋น Client๊ฐ ๋ฑ๋ก๋์ด์๋ ์ง๋ฅผ ๊ฒ์ฌํ๋ค. Sever๋ Login ์ ๋ณด๋ฅผ ํตํด ํด๋น User๊ฐ API๋ฅผ ์ฌ์ฉํ ์ ์๋ ์ง๋ฅผ ๊ฒ์ฌํ๋ค. ๋จ์ API key๋ ๋ชจ๋ Client๋ค์ด ๊ณตํต์ผ๋ก ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ๋ ธ์ถ๋๋ฉด ์ ์ฒด API๊ฐ ๋ ธ์ถ๋๋ค. API key๋ ์๊ฐ์ด ๋ฌด์ ํ์ด๊ณ ํ ๋ฒ ๋ ธ์ถ๋๋ฉด API key ๋ณ๊ฒฝ ์ ๊น์ง ๊ณ์ ๋ ธ์ถ๋๋ค. 2. API Token์ ํตํ ์ธ์ฆ ๊ณผ์ user๊ฐ login ์ ๋ณด๋ฅผ ์ ..
React-query : fetch, cache, synchronize, update(for server state)์ ์ฌ์ฉ๋๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ด๋ค. ๊ณต์์ฌ์ดํธ React Query Hooks for fetching, caching and updating asynchronous data in React react-query.tanstack.com ๋ฐฐ๊ฒฝ server state ์ฌ์ฉ ์ ๋ฐ์ํ ์ ์๋ ๋ฌธ์ ์ ์ ๋ค์๊ณผ ๊ฐ๋ค. caching deduping(๋ฐ์ดํฐ ์ค๋ณต ์ ๊ฑฐ) update "out of date" data / know when is it reflecting updates data pagination optimization, lazy loading data memory management, garba..
query๊ฐ ์ค๋ ๋์๋ค๋ ๊ฒ์ ํ๋จํ๊ณ ๋ค์ fetchํด์ฌ ๋, queryClient.invalidateQueries ํจ์๋ฅผ ์ฌ์ฉํ๋ค. https://react-query.tanstack.com/guides/query-invalidation Query Invalidation Query Invalidation Waiting for queries to become stale before they are fetched again doesn't always work, especially when you know for a fact that a query's data is out of date because of something the user has done. For that purpose, the Quer..
query์ ๋ค๋ฅด๊ฒ CUD์ ์ฌ์ฉ๋๋ค. https://react-query.tanstack.com/guides/mutations Mutations Subscribe to our newsletter The latest TanStack news, articles, and resources, sent to your inbox. react-query.tanstack.com ์ฌ์ฉ์์ const mutation = useMutation(newTodo => axios.post('/todos', newTodo)) return ( {mutation.isLoading ? ( 'Adding todo...' ) : ( {mutation.isError ? ( An error occurred: {mutation.error.mes..
Ajax๋ js๋ฅผ ์ด์ฉํ ๋น๋๊ธฐ ํต์ ์ผ๋ก, ํด๋ผ์ด์ธํธ ์๋ฒ ๊ฐ์ xml(Extensible Markup Language)๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ๋ ๊ธฐ์ ์ด๋ค. ์ ์ฒด ํ์ด์ง๋ฅผ ๋ฆฌ๋ก๋ํ์ง ์๊ณ ํ์ํ ๋ฐ์ดํฐ๋ง ๋ก๋ํ ์ ์๋ค๋ ์ฅ์ ์ด ์๋ค. Ajax ๋ฐฉ์์ ์ด์ฉํ ์น API๋ XMLHttpRequest ๋ถํฐ ์์ํ์ฌ fetch๋ฅผ ๊ฑฐ์ณ axios๊น์ง ๋ค์ํ๋ค. XMLHttpRequest๋ ๋ณต์กํ๊ณ ๊ฐ๋ ์ฑ์ด ๋จ์ด์ง๊ธฐ ๋๋ฌธ์ fetch api๊ฐ ES6์์๋ถํฐ ํ์ค์ด ๋์๋๋ฐ, ๋ฐ๋ผ์ ํ์ฌ fetch api๋ ๊ธฐ๋ณธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก ๋ฐ๋ก ์ค์นํ์ง ์๊ณ ์ฌ์ฉํด๋ ๋๋ค. axios๋ Node.js์์ XMLHttpRequests๋ฅผ ์ฌ์ฉํ๊ธฐ ์ข๊ฒ ๋ง๋ค์ด๋ api์ด๋ฉฐ ๋ฐ๋ก ์ค์นํด์ฃผ์ด์ผ ๋์ํ๋ค. TOP Ajax API๋ฅผ ์ฐธ๊ณ ํ๋ฉด ๋ ๋ง์..
![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbojGsV%2FbtqVdNLpXNm%2FQy3lK12J7XNVFj6Hos5DOk%2Fimg.png)
html2canvas + ์ด๋ฏธ์ง ํธ์คํ *์์ ๋ React Hook ํ๊ฒฝ์์ ์งํ๋์์ต๋๋ค. ๊ฒฐ๊ณผ table์ ์ด๋ฏธ์ง๋ก ๋ง๋ค์ด ๊ณต์ ํด์ผํ๋ ์๊ตฌ์ฌํญ์ด ์์๋ค. ์๊ตฌ์ฌํญ์ ์ํํ๊ธฐ ์ํด์๋ ๋ค์๊ณผ ๊ฐ์ ๊ณผ์ ๋ฅผ ์์ฐจ์ ์ผ๋ก ํด๋ด์ผํ๋ค. html table์ ์ด๋ฏธ์ง๋ก ๋ง๋ค๊ธฐ ๋ง๋ค์ด์ง ์ด๋ฏธ์ง๋ฅผ ํธ์คํ ํ๊ธฐ ํธ์คํ ๋ ์ด๋ฏธ์ง๋ฅผ ์นด์นด์คํก api๋ฅผ ์ด์ฉํ์ฌ ๊ณต์ ํ๊ธฐ ์ฐจ๋ก๋๋ก ํด๋ณด์. html table์ ์ด๋ฏธ์ง๋ก ๋ง๋ค๊ธฐ DOM์์๋ฅผ ์ด๋ฏธ์ง๋ก ๋ง๋ค ๋, html2canvas๋ผ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ฃผ๋ก ์ฐ์ธ๋ค. import html2canvas from 'html2canvas'; const copyDOM = async () => { window.scrollTo(0, 0); let url = ""; await html2canvas(..
![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FnyPoJ%2FbtqZfihdzj8%2FOGRzj3Jtct7gnhHYvDhvCk%2Fimg.png)
[2021-03-04 ์ต์ข ์์ ] ๋ฐ๋จ KOS ํ๋ก์ ํธ ์งํ ์ค์ ์ํ๊ด๋ฆฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ(Redux, Mobx)๋ฅผ ์ถํ ๋์ ํ๊ธฐ๋ก ํ๊ณ , ๋จผ์ MVVM ํจํด๋ง ์ฌ์ฉํ๊ธฐ๋ก ํ์๋ค. ํ์ง๋ง ๊ธฐ์กด์ ๋์์๋ ํด๋ ๊ตฌ์กฐ๋ค์ ๋ชจ๋ react์ Redux / Mobx ๋ฅผ ์ฐ๋ํ์ฌ ๋ง๋ค์ด๋ธ ๊ตฌ์กฐ๋ค์ด์๋ค. ๋ค์์ ์ํ๊ด๋ฆฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ง ์๊ณ MVVM ํจํด์ ๊ตฌํํ ์ฌ์ดํธ์ด๋ค. https://github.com/davinci2015/react-mvvm-pokemon ( Class ์ด์ฉ ) https://velog.io/@dlrmsghks7/whatismvvmpattern ( Hook ์ด์ฉ ) ์์ ์ฌ์ดํธ๋ค์์ ์ ์ํ ๊ตฌ์กฐ๋ฅผ ๊ทธ๋ฆผ์ผ๋ก ๋ํ๋ด๋ณด์. View, View Controller, View Model, Model..
![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F31a4Q%2FbtqGexb73tt%2FPYhCJr7if7Kiw5NVbG8kCk%2Fimg.png)
React Hook React ๊ณต์์ฌ์ดํธ ์ฐธ์กฐ : https://ko.reactjs.org/docs/hooks-intro.html Hook ์๊ฐ Hook์ ์ด๋ค ๊ฒ์ด๊ณ ์ ๋์ค๊ฒ ๋์์๊น? Hook์ด๋? ์ฐ์ Hook์ React 16.8 ๋ฒ์ ์ ์๋ก ์ถ๊ฐ๋ ์ต์ ๊ธฐ๋ฅ์ผ๋ก, ํด๋์คํ ์ปดํฌ๋ํธ์ ๋จ์ ์ ๊ทน๋ณตํ๊ณ ์ ๋์จ ํจ์ํ ์ปดํฌ๋ํธ์ ๋ํ ๊ธฐ๋ฅ์ด๋ค. Hook์ ํจ์ํ ์ปดํฌ๋ํธ๋ก๋ ํด๋์คํ ์ปดํฌ๋ํธ์ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์๋๋ก ํด์ค๋ค. ํจ์ํ ์ปดํฌ๋ํธ๋? // ํด๋์คํ ์ปดํฌ๋ํธ import React, { Component } from 'react'; class App extends Component { render(){ return ( //jsx ); } } export default App; // ํจ์ํ..
Comment