'Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR while using news api in react js
I am working on a reactjs website. The website is basically a news website in which i have used news Api to fetch data but in news api data there is a image url "https://cdn.siasat.com/wp-content/uploads/2021/07/Antarctica.jpg" that is not working .I want to replace it with an image from my folder .I have written a code for this purpose that is successfully changing it to img.jpg image of my folder but it is not showing in my localhost site.
This is the logic i have written to change emptyimage url .
export class Newsitem extends Component {
render() {
// this is called destructuring in js meas you can fetch description and title from single prop
let {title,description,imageurl,newsurl}=this.props
return (
<div className='my-3'>
<div className="card" style={{width: "18rem"}}>
<img src={imageurl==="https://cdn.siasat.com/wp-content/uploads/2021/07/Antarctica.jpg"?"img.jpg":imageurl}className="card-img-top" alt="..."/>
<div className="card-body">
<h5 className="card-title">{title}...</h5>
<p className="card-text">{description}...</p>
<a href={newsurl} target="_blank" className="btn btn-sm btn-primary">Read more...</a>
</div>
</div>
</div>
)
}
}
This is the code after running and inspecting it in console :
<img src="img.jpg" class="card-img-top" alt="...">
This code has changed the url to img.jpg but i don't understand why it is not displaying in my website. My console is showing this "Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR cdn.siasat.com/wp-content/uploads/2021/07/Antarctica.jpg:1".I have already change this url to img.jpg
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
