I have the following JSX code:
import * as React from 'react'
const CheeseIcons = ({ milk }) => {
const milkoji = {
Cow:'1F42E',
Goat: '1F410'
}
const icon = "&#x" + milkoji.[milk] + ";";
return (
<main>
<p>{icon}</p>
<p>🐮</p>
</main>
)
}
export default CheeseIcons
I am passing Cow
correctly as {milk}
- but in the first paragraph the text 🐮
is displayed, whereas in the second paragraph the emoji is displayed.
How do I get the emoji to be displayed in the first paragraph?