import { Link } from "react-router-dom"; import { useState, useEffect } from "react"; import userApi from "../../apis/user.api"; import catchErrors from "../../context/catchError"; const userprofile = localStorage.getItem("user"); const INIT_USER = { id: userprofile, email: "", img: "", }; const HomeProfile = () => { const [user, setUser] = useState(INIT_USER); const [error, setError]= useState(""); async function getSetUser(userID) { try { const data = await userApi.getUser(userID); setUser(data); } catch (error) { catchErrors(error, setError); } } useEffect(() => { getSetUser(userprofile); }, [userprofile]); return (

{user.email}

#{user.id}

); }; export default HomeProfile;