From e9394f2b12753df666ae7cf822744839fbb72db4 Mon Sep 17 00:00:00 2001 From: ian Date: Mon, 5 Aug 2024 11:14:10 +0800 Subject: [PATCH] docs: useTheme add localStorageKey --- packages/hooks/src/useTheme/demo/demo1.tsx | 4 +++- packages/hooks/src/useTheme/index.en-US.md | 4 +++- packages/hooks/src/useTheme/index.zh-CN.md | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/hooks/src/useTheme/demo/demo1.tsx b/packages/hooks/src/useTheme/demo/demo1.tsx index d525c0ed74..8dd7708cc1 100644 --- a/packages/hooks/src/useTheme/demo/demo1.tsx +++ b/packages/hooks/src/useTheme/demo/demo1.tsx @@ -10,7 +10,9 @@ import { useTheme } from 'ahooks'; import React from 'react'; export default () => { - const { theme, themeMode, setThemeMode } = useTheme(); + const { theme, themeMode, setThemeMode } = useTheme({ + localStorageKey: 'themeMode', + }); return ( <> diff --git a/packages/hooks/src/useTheme/index.en-US.md b/packages/hooks/src/useTheme/index.en-US.md index 09e4d15fed..4cd1694534 100644 --- a/packages/hooks/src/useTheme/index.en-US.md +++ b/packages/hooks/src/useTheme/index.en-US.md @@ -16,7 +16,9 @@ This hook is used to get and set the theme, and store the themeMode into localSt ## API ```typescript -const { theme, themeMode, setThemeMode } = useTheme(); +const { theme, themeMode, setThemeMode } = useTheme({ + localStorageKey?: string; +}); ``` ### Result diff --git a/packages/hooks/src/useTheme/index.zh-CN.md b/packages/hooks/src/useTheme/index.zh-CN.md index 6093f67819..4461a00631 100644 --- a/packages/hooks/src/useTheme/index.zh-CN.md +++ b/packages/hooks/src/useTheme/index.zh-CN.md @@ -16,7 +16,9 @@ nav: ## API ```typescript -const { theme, themeMode, setThemeMode } = useTheme(); +const { theme, themeMode, setThemeMode } = useTheme({ + localStorageKey?: string; +}); ``` ### 返回值