I'm having a problem with my get request function using Axios. whenever its got called, the get function always runs twice. I don't know what the problem is here. I have tried removing React.Strictmode tag but nothing changed. I started to think the webpack dev server is the problem here. Here is my code :
- my get Request function :
export default async function useSendResquest(url, handler) {
var Response;
Response = await axios.get(url).then((response) => {
return response.data;
});
return handler(Response);
}
- My UseEffect Call :
useEffect(() => {
useSendResquest(
"http://localhost:8080/api/control?name=rgbLed&status",
(Response) => {
setLightState(Response);
}
);
console.log("hi");
}, []);
- Network activity :
does anyone have any clue?
Thank you all

