From 46f5d7917cbc11deee25028e57d0b477b42d4037 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 10 Oct 2024 00:56:00 +0800 Subject: [PATCH] Fix dup keys --- src/components/emoji-text.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/emoji-text.jsx b/src/components/emoji-text.jsx index 441836c5..2200aadf 100644 --- a/src/components/emoji-text.jsx +++ b/src/components/emoji-text.jsx @@ -17,12 +17,17 @@ function EmojiText({ text, emojis }) { // 'g', // ); const regex = shortcodesRegexp(emojis.map((e) => e.shortcode)); - const elements = text.split(regex).map((word) => { + const elements = text.split(regex).map((word, i) => { const emoji = emojis.find((e) => e.shortcode === word); if (emoji) { const { url, staticUrl } = emoji; return ( - + = 2 same shortcodes + /> ); } return word;