Menggunakan efek dengan aksios bereaksi
let [ posts, setPosts ] = useState([])
useEffect(() => {
async function getResults() {
const results = await axios('https://jsonplaceholder.typicode.com/posts');
setPosts(results.data)
}
getResults()
},[])
console.log(posts)
Moise Mbakop