import styles from "./my-info.module.scss"; import { useAuth } from "../../context/auth_context"; import { useState, useEffect } from "react"; import authApi from "../../apis/auth.api"; const MyInfo = () => { const { user } = useAuth(); const [userNickName, setUserNickName] = useState(user.nickname); const getNickName = async (id) => { console.log(id); const nickname = await authApi.getNickName(id); console.log(nickname); return nickname } useEffect(() => { let name = getNickName(user.id); setUserNickName(name); }, []) return (
마이페이지
{`${userNickName}`}님 반갑습니다!
) } export default MyInfo