diff --git a/src/components/PollsList.tsx b/src/components/PollsList.tsx index 0b9f84e..4d48705 100644 --- a/src/components/PollsList.tsx +++ b/src/components/PollsList.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState, useCallback } from "react"; +import { useEffect, useState } from "react"; import NProgress from "nprogress"; import { Trash } from "react-bootstrap-icons"; import { useSelector } from "react-redux"; @@ -35,7 +35,7 @@ const PollsList = (): JSX.Element => { const [modalShow, setModalShow] = useState(false); const [id, setId] = useState(""); - const getData = useCallback(async (): Promise => { + const getData = async (): Promise => { try { NProgress.start(); const fetchedPolls = await serverAPI.getPolls({ @@ -56,12 +56,11 @@ const PollsList = (): JSX.Element => { setMessage("Unable to fetch polls. Check your connection."); NProgress.done(); } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - + }; useEffect(() => { getData(); - }, [getData]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); const handleDelete = async (pollID: string): Promise => { try {