📅  最后修改于: 2022-03-11 14:58:06.009000             🧑  作者: 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)}
)
}