here is my code:
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
class MovieCard extends Component {
render() {
const { title, movieImg, genre, id } = this.props.movie;
if(movieImg) {
return (
<article>
<div className="card my-4">
<img src = {movieImg}
width = "920" height = "524" alt = "" className = "img-fluid card-img-top" />
<div className="card-body text-center">
<h5>{title}</h5>
<p>{genre.name}</p>
</div>
<Link to = {`/movies/${id}`} className="btn btn-primary mb-3 width">
Change Image
</Link>
</div>
</article>
);
} else if (movieImg === "") {
return (
<article>
<div className="card my-4">
<img src = "https://github.com/Ceci007/images/blob/master/img-vidly/image-default.jpg?raw=true"
width = "920" height = "524" alt = "" className = "img-fluid card-img-top" />
<div className="card-body text-center">
<h5>{title}</h5>
<p>{genre.name}</p>
</div>
<Link to = {`/movies/${id}`} className="btn btn-primary mb-3 width">
Change Image
</Link>
</div>
</article>
);
}
}
}
export default MovieCard;