The full Error message is about this:
And here is the code I wrote using axios to consume the ny times API.
export default function App() {
const [info, setInfo] = useState([]);
// Load dos dados da api
useEffect(() => {
async function loadNews() {
const response = await api.get('/arts.json');
const { results } = response.data;
console.log(results);
setInfo(results);
}
loadNews();
}, []);
return (
<>
<Main>
<Title>Technology</Title>
<Content>
{info.map(news => <Text key={news.url}>{news.title}</Text> )}
</Content>
<Title>Science</Title>
</Main>
</>
);
}
Is a better way of loading these json object. including maybe a pagination? Why is it giving me this error? should i use async functions outside useEffect hook but I dont know how