i have very strange problem my console return Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
i readed on topics here i and tryed alot of solutions with unmounted example true and false but i didnt solve my problem heres the code:
const [getCompany, setgetCompany] = useState('');
useEffect(() => {
const fetchCompany = async () => {
try {
const responseData = await sendRequest(
`http://localhost:5000/api/companies/${props.company}`,
);
setgetCompany(responseData);
} catch (err) {}
};
props.company && fetchCompany();
}, [props.company]);
and in return i did this:
{(() => {
if(getCompany){
return Object.keys(getCompany).map((item,index) => {
return(
<img
key={getCompany[item].id}
src={`http://localhost:5000/${getCompany[item].image}`}
alt={getCompany[item].title}
/>
)
})
}
})()}
this is just function to get details from companies like photo, any help?