I'm trying to call API when I'm in the page that show data for the specific Profile.
The url looks like: localhost:8000/profile/223
API also require to be called api/profile/223
The way that I'm trying to call the API is:
const ProfileLayout = () => {
const [profileId, setProfileId] = useState();
useEffect(() => {
fetch('api/profile/id')
.then(result => {
setProfileId(result.id);
});
}, [id])
};