import { Link } from "react-router-dom"; import { useState, useEffect } from "react"; import userApi from "../../apis/user.api"; const userprofile = localStorage.getItem("user"); const INIT_USER = { id: userprofile, name: '', img: '', } const HomeProfile = () => { const [user, setUser] = useState(INIT_USER) async function getSetUser(userID) { try { // `/users/${userId}`랑 userId랑 같은지 확인 console.log('userID',userID) const data = await userApi.getUser({id: userID}) console.log(data) setUser(data) console.log(user) } catch (error) { // catchErrors(error, setError) } } useEffect(() => { console.log('예에에에에ㅔ에에') getSetUser(userprofile) }, [userprofile]) return (

{user.name}

#{user.id}

); }; export default HomeProfile;