I've an object showing genres with their counts. It looks like this.
const totalGenresWatchedCount = {
"Comedy": 3,
"Romance": 2,
"Adventure": 1,
"Science Fiction": 1,
"Action": 2,
"Drama": 1,
"Family": 1,
"Crime": 1,
"Thriller": 1
}
I also have another array containing all the genres listed.
const totalUniqueGenresWatched = ["Comedy", "Romance", "Adventure", "Science Fiction", "Action"].
What I want to achieve is get all the genre and the count printed together. Ive tried with the this code.
totalUniqueGenresWatched.map((genre) => {
return (
<p>
{genre} - {totalGenresWatchedCount.genre}
</p>
);
})
I cant seem to print the object value from the genre key, if I remove the first genre VS Code IntelliSense predicts that the key is not even getting used. Am i missing anything?