Skip to content

Commit a76123d

Browse files
✨ feat(fluentemoji): Add dependency and create fallback variable
- Add "emoji" variable to useEffect dependency array - Create "isFallback" variable using useMemo hook - Use "isFallback" in if statement for component return value This commit introduces new features to the "FluentEmoji" component. The "emoji" variable is added to the dependency array in the useEffect hook, ensuring that the effect is triggered when the "emoji" value changes. Additionally, a new variable "isFallback" is created using the useMemo hook, which helps determine if the component is in a fallback state. This variable is then used in an if statement to determine the return value of the component.
1 parent 2287e58 commit a76123d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/FluentEmoji/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ const FluentEmoji = memo<FluentEmojiProps>(
5858
});
5959
}
6060
}
61-
}, [type]);
61+
}, [type, emoji]);
6262

63-
if (type === 'pure' || !emojiUrl || loadingFail)
63+
const isFallback = useMemo(() => type === 'pure' || !emojiUrl || loadingFail, []);
64+
65+
if (isFallback)
6466
return (
6567
<div
6668
className={cx(styles.container, className)}

0 commit comments

Comments
 (0)