两者之间有区别吗?
useEffect(()=>{
async function fetchData(){
await axios
.get(path, config)
.then(resp=>console.log(resp))
.catch(error=>console.log(error))
}
fetchData();
},[])
&;
useEffect(()=>{
axios
.get(path, config)
.then(resp=>console.log(resp))
.catch(error=>console.log(error))
},[])
有更推荐的还是比另一种折旧更多的?
就结果而言,两者都是一样的,"异步"是较新的,但除此之外,还有什么吗?
谢谢,