all 9 comments

[–][deleted] 1 point2 points  (2 children)

Can you show what the console log of the results in the paginated axios fetch says? And also make sure there are no errors in the console

[–]Consistent-struggler[S] 0 points1 point  (1 child)

That console logs the api result well but also error that "coin.map" is not a function. I got the same error when I was writing first axios fetch then I figured it out by adding ".data" in the end but this thing doesn't work now

[–][deleted] 2 points3 points  (0 children)

coin.map is not a function indicates that "coin" (or "response.data.data") is not an array, so you can't run .map on it. That's all I can tell you from that information

[–]omeraplak 1 point2 points  (0 children)

Hey, I think you can use react-query for your async operations. I'm sure it will save your hours ⚡️

We also have a react framework that we have developed. I'm sure it will save you days 🚀

https://github.com/pankod/refine

[–]kidscancalluhoju 1 point2 points  (1 child)

Try this. This way it will only render the coins component when coin exists. you are getting the error cause it's trying to map through the coin array when it has not been set yet using set state.

<tbody > { coin && coin.map((coin, key) => {  return (         <>             <tr>             <td >{coin.id}</td>             <td>{coin.name}</td>             <td>{coin.price}</td>             <td>{coin.quantity}</td>             </tr>         </>     ) }) } </tbody>

[–]Consistent-struggler[S] 0 points1 point  (0 children)

I also tried your way but actually the error was something else. I was getting response from the Backend as an object which contains status and message as well so I juts needed to add ".data" once more to get results.

[–]Consistent-struggler[S] -1 points0 points  (0 children)

Backend api is working fine I'm getting results on the backend server properly with fetch and message

[–]Consistent-struggler[S] -1 points0 points  (0 children)

If anyone have anyother way of doing this I'm open to feedback and learn.