📅  最后修改于: 2022-03-11 15:01:11.185000             🧑  作者: Mango
function OutsideUsageExample() {
const [data, dataSet] = useState(null)
const fetchMyAPI = useCallback(async () => {
let response = await fetch('api/data')
response = await response.json()
dataSet(response)
}, [])
useEffect(() => {
fetchMyAPI()
}, [fetchMyAPI])
return (
data: {JSON.stringify(data)}
)
}