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) async function getSetUser(userID) { try { // console.log('userID', userID) const data = await userApi.getUser(userID) // console.log(data) setUser(data) // console.log(user) } catch (error) { // catchErrors(error, setError) } } useEffect(() => { getSetUser(userprofile) }, [userprofile]) return (
); }; export default HomeProfile;