const FALLBACK_IMAGE = "https://devprojectupload.s3.ap-south-1.amazonaws.com/32490.png";
const ModelComponent = (props) => {
const [height, setHeight] = useState(window.innerHeight);
const [width, setWidth] = useState(window.innerWidth);
//API data
const [modelData, setModelData] = useState([]);
//Error
const [isError, setIsError] = useState("");
useEffect(() => { axios. get("https://51fgc922b7.execute-api.ap-south-1.amazonaws.com/dev/productpreview") .then((res) => { console.log(res.data.data) setModelData(res.data.data[0]) }) .catch((error)=> setIsError(()=>{ , error }) ) }, []);
Currently you're not returning anything in your
setIsErrorfunction. You can return the error you receive from the catch or just set it totrueIn the return of your component you could do something like this, where you check if there is an error and if there is you display your
img