I have an emoji component in which I loop through an array of emojis (SVG's) that's stored like this:
Constant Emojis Array:
import { ReactComponent as Coin } from "../assets/emojiIcons/coin.svg"
import { ReactComponent as Rocket } from "../assets/emojiIcons/rocket.svg"
const DEFAULT_EMOJI_OPTIONS = [
{
emoji: Rocket,
label: "rocket",
},
{
emoji: Coin,
label: "coin",
},
]
export { DEFAULT_EMOJI_OPTIONS }
and I'm also getting emoji count from the reactions array(it's coming from firebase). The reactions array looks like this:
reactions: [
{
"emoji": "rocket",
"label": "rocket",
"count": 23,
"users": [
"3322424",
"3243242"
]
},
{...},
{...}
]
I would like to know how to add an emoji count that I'm getting from firebase inside a map in the below code?
Emoji component:
import { DEFAULT_EMOJI_OPTIONS } from "../../utils/emojis"
const EmojiSection = ({reactions}) => {
return (
<div className="text-white border-2 border-gray-800 rounded p-3 my-8 max-w-xs mx-auto">
{DEFAULT_EMOJI_OPTIONS.map((emoji) => (
<span
key={emoji.label}
onClick={() => console.log("clicked")}
>
<emoji.emoji width={32} height={32} />
<span>
{ADD EMOJI COUNT FROM FIREBASE}
</span>
</span>
))}
</div>
)
}
DEFAULT_EMOJI_OPTIONSand then add the corresponding count to each emoji from firebase.