📅  最后修改于: 2022-03-11 15:02:42.483000             🧑  作者: Mango
let [ posts, setPosts ] = useState([])
useEffect(() => {
async function getResults() {
const results = await axios('https://jsonplaceholder.typicode.com/posts');
setPosts(results.data)
}
getResults()
},[])
console.log(posts)