There seems to be a problem with the function Card(props).
The output is fine if I replace the function's content with
<img src="data[0].img"
instead of props.img
, etc.
var data =
[{
id: 1,
name: "tokyo",
descr: "a",
img: "/tokyo.png"
}
]
function Card(props) {
return (
<div>
<img src={props.img}/>
<h1> {props.name}</h1>
<p> {props.descr}</p>
</div>
)
}
const cards = data.map(item => {
return (<Card
img={item.img}
name={item.name}
descr={item.descr}
key={item.id} />)
})
ReactDOM.render({cards},document.getElementById("root"))