From 2e080d2fe207c91c9fd6cb49bb0ce2186c19f82d Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Tue, 25 Mar 2025 10:10:02 -0400 Subject: Apply suggestions from code review Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Signed-off-by: Xe Iaso --- docs/src/components/RandomKey/index.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'docs/src/components') diff --git a/docs/src/components/RandomKey/index.tsx b/docs/src/components/RandomKey/index.tsx index f1eb63a..e7ced3e 100644 --- a/docs/src/components/RandomKey/index.tsx +++ b/docs/src/components/RandomKey/index.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from "react"; +import { useState, useCallback } from "react"; import Code from "@theme/CodeInline"; import BrowserOnly from "@docusaurus/BrowserOnly"; @@ -20,17 +20,16 @@ export default function RandomKey() { Loading...}> {() => { const [key, setKey] = useState(genRandomKey()); - const [refresh, setRefresh] = useState(0); - useEffect(() => { + const genRandomKeyCb = useCallback(() => { setKey(genRandomKey()); - }, [refresh]); + }); return ( {key}