180 Websites in 180 Days: Day 34
Check out today’s page and the rest of my projects here!
Today’s page is Free Code Camp’s Twitch.tv project. I put off this project for most of the day. When I finally got to it I ran into a dumb error that took me 9 hours to solve.
For some reason, it wasn’t mapping through my array data to correctly display the users. Even though when I would console.log that data it would show the correct stuff, when I tried to map through it would show nothing. I decided to log data.length and it showed up as 0 and I immediately knew what the problem was. It was in a component two levels up.
My axios.get call returns the data asynchronously so I had to set the state in .then() to send the correct data through the state. After I moved this ONE line everything worked perfectly.
I wanted to add in a search bar and a filter to this project but due to the fact I already went over my time, I did the bar minimum for this project. I will update this project to have both of those when I record the video for YouTube though!
If anyone checks out the code on GitHub, I’d appreciate any and all feedback. I think the one thing that could help most new coders is code reviews so they can better themselves rather than get stuck in bad habits.