So I have a component that looks like this
import React from "react";
interface CInterface {
name: string;
word: string;
path: string;
}
export function C({ name, word, path }: CInterface) {
return (
<div>
<h2>{name}</h2>
<>
<img src={path} alt={name + "" + word} width="600" height="300" />
</>
</div>
);
}
and the app.tsx file is like this
import React from "react";
import { C } from "./components/c";
function App() {
return (
<div className="App">
<h1> K </h1>
<ul>
<li>
{" "}
<C name="B1" word=" is the best " path="./Images/B1.png" />
</li>
</ul>
</div>
);
}
export default App;
But the image doesn't load. How do i make it dynamic?
I want to pass both the image name and image path to the component.