From 70e936e2d70040c7552386a0849f780ba5996b09 Mon Sep 17 00:00:00 2001 From: Sina Iman Date: Fri, 15 Sep 2023 03:45:29 +0200 Subject: [PATCH] usecallback for explore --- pages/explore.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/explore.tsx b/pages/explore.tsx index 2433bf9..36890ec 100644 --- a/pages/explore.tsx +++ b/pages/explore.tsx @@ -1,5 +1,5 @@ import type { NextPage } from "next"; -import { useEffect, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { useCeramicContext } from "@/context"; import { ROProps } from "@/types"; import Head from "next/head"; @@ -15,14 +15,14 @@ const ExplorePage: NextPage = () => { const { composeClient } = clients; const [objects, setObjects] = useState([]); - const getResearchObjects = async () => { + const getResearchObjects = useCallback(async () => { const researchObjects = await queryResearchObjects(composeClient); setObjects(researchObjects); - }; + }, [composeClient]); useEffect(() => { getResearchObjects(); - }, []); + }, [getResearchObjects]); return ( <>