When editing specific data, that specific data is not loaded for editing. This is the code of the edit file. I used frontend technology as React js and Backend technology as Koa js. Here I used mongo DB as a Database. This code does not work correctly for editing. Is there any issue with the code?
useEffect(() => {
axios.get("http://localhost:5000/student/${id}").then((res) => {
setStudent(res.data.existingData);
setName(res.data.existingData.name);
setAge(res.data.existingData.age);
setCity(res.data.existingData.city);
});
}, []);
Please use backticks to define a URL
axios.get(`http://localhost:5000/student/${id}`).then((res) => {