📅  最后修改于: 2022-03-11 15:02:02.705000             🧑  作者: Mango
const GetAPILinks = () => {
const [apiData, setApiData] = React.useState([]);
const [fetchUrl, setFetchUrl] = React.useState('');
React.useEffect(() => {
if (fetchUrl) {
fetch(fetchUrl)
.then((response) => {
return response.json();
})
.then((data) => {
setApiData(data);
});
}
}, [fetchUrl]);
return (
{setFetchUrl(e.target.eventKey)}}>
Link 1
Link 2
Link 3
);
}