I want to load a default image if the image URL gives a 404 error. I tried onError() in image prop but it's not working.
<Image
onError={() => {
setError(true);
}}
source={{
uri: error
? imageUrl
: "https://logodownload.org/wp-content/uploads/2019/07/udemy-logo-5.png",
}}
style={{
height: 50,
width: "100%",
alignItems: "center",
justifyContent: "center",
}}
resizeMode="cover"
/>
How can I do this thing?