Hello,
- I am working on a personal project where I am fetching from an API and retrieving prices from stocks. I am displaying four different stocks on the homepage. The thing is I want to clear up my code because I am having to fetch four times, set state four times, send four props, and render four divs from one component.
I am using an npm package called axios to fetch (although that doesn't matter) I tried using .getall but it wasn't working.
I have tried pushing the data received into an empty global array like this; dataArray.push(res.data) from each fetch but it also did not work. the data received only gives me an object
c: 306.81
d: 7.88
dp: 2.6361
and etc. It does not give me the ticker name.
Here is a link to a scrim of the code from my vscode but NOTE: The app does not work on this scrim, I think because i have dependencies not installed. I am not sure but below i also supplied a live link from my github pages that does work.
Scrim with code (app does not render here)
https://scrimba.com/scrim/cMDGLgSG
Github pages (app does render here 👍, the info related to the first question is on home page and stats component. )
https://diegoram23.github.io/stock-market-watchlist/
Thank you very much for anyone who has made it this far into the reading and I am grateful for being a part of this discord with such smart people.