반응형

Solution

const [img, setImg] = useState('')


 useEffect(()=>{
    if(data.image){
      setImg(data.image)
    } else{
      setImg("/no_image.png")
    }
  },[])
  const onError = () =>{
    setImg("/no_image.png")
  }
  
     <Image alt="babam-logo" className=' ' layout='fill' src={img} onError={onError} width={196} height={196} />
반응형
복사했습니다!