I want to add dynamic id to axios call method patch
axios. patch('classrooms/dynamic id here? Api _ key=9345c'. I tried ${id} but it gives an error id not defined
function postData(){
axios.patch(`classrooms/${id}?api_key=${API_KEY}`,`subject=${change}`).then((res)=>
console.log(res.data)
).catch((err)=> console.log(err));
}
I want to use this function onClick event so if I tried to define id using const postData() wont work . Any way to add Id dynamically?