📅  最后修改于: 2022-03-11 14:58:19.293000             🧑  作者: Mango
import { useEffect } from 'react';
const Translator = () => {
const [languages, setLanguages] = useState([]);
useEffect(() => {
getLanguages().then(data => {
setLanguages(data.languages)
});
console.log(languages);
}, []);
return (
{
languages.length > 0 && (
languages.map( lang => {lang.language}
)
)
}
);
};