'Getting Axios data with an Array in React Typescript
This is the Response from my Server:

Im trying fetch data from Array. How can i do that please?
const instance = axios.create({
baseURL: 'https://localhost:5001/api/products',
timeout: 15000,
});
const responseBody = (response: AxiosResponse) => response.data.value;
const requests = {
get: (url: string) => instance.get(url).then(responseBody)
};
const Post = {
getPosts: (): Promise<Article[]> => requests.get('/article'),
}
useEffect(() => {
Post.getPosts()
.then((data) => {
setArticle(data);
});
return () => {};
}, []);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
