항해99 12기 - 230227TIL

지윤·2023년 2월 28일
0

항해99

목록 보기
33/40

오늘 배운 것

  • react-query : useMutation
    구조 분해 할당으로 사용 할 수 있다!!
const {
   data,
   error,
   isError,
   isIdle,
   isLoading,
   isPaused,
   isSuccess,
   mutate,
   mutateAsync,
   reset,
   status,
 } = useMutation(mutationFn, {
   mutationKey,
   onError,
   onMutate,
   onSettled,
   onSuccess,
   retry,
   retryDelay,
   useErrorBoundary,
   meta,
 })
 
 mutate(variables, {
   onError,
   onSettled,
   onSuccess,
 })
  • 백엔드에서 전달해준 error log 프론트에 띄워주기

참고한 웹사이트

https://react-query-v3.tanstack.com/reference/useMutation

profile
방금 태어난 개발자

0개의 댓글