티스토리 뷰
"use client";
import { useSession } from "@/hooks/useUserProfile";
import supabase from "../../../utils/supabase/client";
import { useEffect, useState } from "react";
import { Database, Tables } from "../../../../database.types";
const ApplyStudyList = () => {
const [studyApplyList, setStudyApplyList] = useState([]);
//유저 정보 가져오기
const { data: user } = useSession();
console.log(user);
useEffect(() => {
// 스터디 신청 데이터 가져오기
const getStudyApplyList = async () => {
const { data , error } : {data : Tables<"study_applylist">[], error : null} = await supabase
.from("study_applylist")
.select("*")
.eq("user_id", user?.id);
if (error) {
console.error(
"Error fetching data getStudyApplyList : ",
error.message,
);
} else if (data) {
console.log("유저 스터디 신청 데이터 test", data);
setStudyApplyList(data );
}
};
getStudyApplyList();
}, []);
return <div>{studyApplyList}</div>;
};
export default ApplyStudyList;
스터디 그룹 페이지를 하는데 타입 설정이 좀 막혔음.
hellozero님한테 물어보니까 tanstack query를 사용하는 법을 가르쳐 주셨고 그걸 쓰니까 코드가 훨씬 깔끔해지고 쓰기 쉬워지는 걸 봤음.
낼 한 세시까지 투자해서 tanstack query를 좀 연습하려고 함. 오늘은 이제 좀 쉬고
waterhe님도 그렇고 실력자들이 옆에 있어서 배울 게 많아서 좋다.
'TIL > 일기, 공부 내용 정리' 카테고리의 다른 글
undefined와 null, 실행 컨텍스트 정리 (0) | 2024.12.17 |
---|---|
기본형과 참조형, 불변 객체 정리 (0) | 2024.12.16 |
팀 과제 스밋 - 와이어프레임 만들기, 기능 세분화, 간단한 역할 분담 (1) | 2024.10.18 |
미루는 습관 고치기 3 (0) | 2024.09.25 |
Tanstack Query의 필요성 리뷰 (2) | 2024.09.23 |