From a61706afefd4bfe3149816c56a86ace109948514 Mon Sep 17 00:00:00 2001 From: canisminor1990 Date: Sun, 16 Jul 2023 11:17:27 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(fluentemoji):=20R?= =?UTF-8?q?eplace=20useLocalStorageState=20with=20useState=20hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit refactors the "FluentEmoji" component by removing the "useLocalStorageState" import and replacing it with the useState hook. The "emojiUrl" state is also updated to use useState instead of useLocalStorageState. Changes: - Replace useLocalStorageState with useState hook - Update emojiUrl state to use useState instead of useLocalStorageState --- src/FluentEmoji/index.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/FluentEmoji/index.tsx b/src/FluentEmoji/index.tsx index cc9c196d..d35aaa4b 100644 --- a/src/FluentEmoji/index.tsx +++ b/src/FluentEmoji/index.tsx @@ -1,4 +1,3 @@ -import { useLocalStorageState } from 'ahooks'; import { kebabCase } from 'lodash-es'; import { memo, useEffect, useState } from 'react'; @@ -27,12 +26,7 @@ export interface FluentEmojiProps extends DivProps { const FluentEmoji = memo( ({ emoji, className, style, type = 'modern', size = 40 }) => { const [loadingFail, setLoadingFail] = useState(false); - const [emojiUrl, setEmojiUrl] = useLocalStorageState<{ [key: string]: string }>( - 'lobe-ui-emoji', - { - defaultValue: {}, - }, - ); + const [emojiUrl, setEmojiUrl] = useState<{ [key: string]: string }>({}); const { cx, styles } = useStyles(); useEffect(() => {