I am passing the image name as props in the instance of the Card component in App.js. Then I am receiving it from the Card component and render it to the DOM. But my image is not showing in the DOM. What could be the reason?
This is my App.js
import React from "react";
import "./style.css";
import Navbar from "./components/Navbar";
import Hero from "./components/Hero";
import Card from "./components/Card";
import "./images/image12.png";
import "./images/Star1.png";
function App() {
return (
<div className="App">
<Navbar />
<Hero />
<Card
img="image12.png"
star="Star1.png"
obtainedRating={5.0}
TotalRating="6-USA"
briefText="Life lessons with Katie Zaferes"
price="$136"
person="/person"
/>
</div>
);
}
export default App;
Here is my Card component
import React from "react";
import "../style.css";
import "../images/image12.png";
import "../images/Star1.png";
export default function Card(props) {
console.log(props);
return (
<div className="card--section">
<img src={`../images/${props.img}`} className="card--image" alt="Katie" />
<div className="rating">
<img
src={`../images/${props.star}`}
className="star--image"
alt="star"
/>
<small>
{props.obtainedRating} <span>{props.totalRating}</span>
</small>
</div>
<p className="brief-text">{props.briefText}</p>
<p className="price">
<strong>{props.price}</strong>
{props.person}
</p>
</div>
);
}
This is my Folder structure
src -components -Card.js -images -image12.png -Star1.png -App.js -index.js
