import { Link, useParams } from "react-router-dom"; import { useState, useEffect } from "react"; import userApi from "../../apis/user.api"; const userprofile = localStorage.getItem("user"); const INIT_PROFILE = { img:"", }; const Profile = () => { const [profile, setProfile] = useState(INIT_PROFILE); async function getProfile(userID) { try { const data = await userApi.getUser({id:userID}); console.log(data.img) setProfile(data.img) } catch (error) {} } useEffect(() => { getProfile(userprofile); }, [userprofile]); const { id } = useParams(); console.log(id); return (
<>
); }; export default Profile;