From 8eccf4fba75893bbcefb6ef3deb54fa3becaedad Mon Sep 17 00:00:00 2001 From: tangxuezhi <0x74616e67@gmail.com> Date: Tue, 15 Nov 2022 16:38:28 +0800 Subject: [PATCH 01/42] feat: remove useless useGlobal code, use useGlobalData hook instead --- src/app/containers/Footer/Currency.tsx | 10 +- src/app/containers/TokenDetail/index.tsx | 4 - src/app/containers/Tokens/index.tsx | 5 - src/app/index.tsx | 1072 +++++++++++----------- src/utils/hooks/useGlobal.ts | 45 +- 5 files changed, 523 insertions(+), 613 deletions(-) diff --git a/src/app/containers/Footer/Currency.tsx b/src/app/containers/Footer/Currency.tsx index c78ae9d9f..237b282d4 100644 --- a/src/app/containers/Footer/Currency.tsx +++ b/src/app/containers/Footer/Currency.tsx @@ -6,21 +6,21 @@ import styled from 'styled-components/macro'; import { trackEvent } from 'utils/ga'; import { ScanEvent } from 'utils/gaConstants'; import { LOCALSTORAGE_KEYS_MAP } from 'utils/constants'; -import { useGlobal } from 'utils/hooks/useGlobal'; +import { useGlobalData } from 'utils/hooks/useGlobal'; export function Currency() { const { t } = useTranslation(); - const { data, setGlobalData } = useGlobal(); + const [globalData, setGlobalData] = useGlobalData(); const handleCurrencyChange = currency => { localStorage.setItem(LOCALSTORAGE_KEYS_MAP.currency, currency); trackEvent({ category: ScanEvent.preference.category, action: ScanEvent.preference.action.changeCurrency, - label: data.currency, + label: globalData.currency, }); setGlobalData({ - ...data, + ...globalData, currency, }); }; @@ -69,7 +69,7 @@ export function Currency() { - - - - - - - -