skip to Main Content

Reactjs – Prevent fetch making unwanted requests

fetch is making multiple unwanted requests, I tried the below but it still makes 6 to 10 requests const [allowParse, setAllowParse] = useState<boolean>(true); socket.on("upload_finished", function (response) { if (allowParse === true) { console.log("parse start"); fetch("start-parse", {method: "POST"}); setAllowParse(false) } });…

VIEW QUESTION
Back To Top
Search