useSWR 사용기

신상우·2024년 10월 23일

사이드 프로젝트

목록 보기
11/11
export const fetcher = (...args: [string]) =>
  fetch(...args).then((res) => res.json());

이렇게 get 요청에만 사용했는데

useSWR을 사용해서 POST, PUT, DELETE 에도 사용하려고 찾아보니

useSWRMutation 를 찾게되었다.

https://swr.vercel.app/ko/docs/mutation

https://www.daehun.me/frontend/swr/useswrmutation-mutate

이렇게 적용 해보면 될거같다.

useSWR 을 사용해야하는 이유? 아직 정확히 잘알지못함!
이해 하기 쉽게 정리 정말 잘한 유튜브링크
https://youtu.be/1Vsv7lJeWZo?si=2oAVdfKFU7jRUOPn

profile
기록 남기기

0개의 댓글