ما الفرق بين الطريقتين
useEffect(() => {
fetch('api')
.then((res) => res.json())
.then((data) => setCategrouApi(data))
},[])
const fetchApi = async () => {
try{
const res = await fetch('api')
const data = res.json();
console.log(data)
}catch(e){
console.log(e)
}
}
const fetchApi = async () => {
try{
const res = await fetch('api')
const data = res.json();
console.log(data)
}catch(e){
console.log(e)
}
}