From 706ca5a5617158bcfe77b40698c63e1848739b53 Mon Sep 17 00:00:00 2001 From: ingawei Date: Thu, 21 Jul 2022 12:15:41 -0700 Subject: [PATCH] got rid of conditional useState --- web/pages/links.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/pages/links.tsx b/web/pages/links.tsx index 1a716afe..896602b6 100644 --- a/web/pages/links.tsx +++ b/web/pages/links.tsx @@ -82,6 +82,10 @@ function ManalinksDisplay(props: { highlightedSlug: string }) { const { unclaimedLinks, highlightedSlug } = props + const [page, setPage] = useState(0) + const start = page * LINKS_PER_PAGE + const end = start + LINKS_PER_PAGE + const displayedLinks = unclaimedLinks.slice(start, end) if (unclaimedLinks.length === 0) { return ( @@ -91,10 +95,6 @@ function ManalinksDisplay(props: {

) } else { - const [page, setPage] = useState(0) - const start = page * LINKS_PER_PAGE - const end = start + LINKS_PER_PAGE - const displayedLinks = unclaimedLinks.slice(start, end) return ( <>