8
My first React project broke because I used a class component instead of a function
I started learning React about 3 months ago by following this old tutorial that taught everything with class components. I built this whole little to-do app, like 400 lines of code, and it worked fine on my computer. But when I pushed it to GitHub and tried to share it with someone, they couldn't get it to run at all. Turns out the tutorial was from 2019 and used an old version of React that doesn't work with newer setups. I had to rewrite the entire thing as function components with hooks. It took me like 2 full evenings and I was so frustrated. But honestly, I learned way more about how React actually works by fixing it myself than I ever did following that outdated tutorial. Has anyone else gotten stuck following an old tutorial and had to backtrack like that?
2 comments
Log in to join the discussion
Log In2 Comments
anthonymurray1d agoTop Commenter
Had a buddy who learned Vue from a 2016 tutorial and spent a whole weekend wondering why his components were broken. Turned out the entire API changed between versions 2 and 3 and nothing he wrote was compatible. He ended up scrapping the whole thing and starting over with a fresh tutorial and said it was the best learning experience he ever had.
1
lily_singh21d ago
My friend did the same thing with React actually. He found this really popular tutorial from like 2017 and got halfway through building a todo app before everything started breaking. He didn't realize the tutorial was using class components and lifecycle methods that are basically obsolete now. He spent two days googling errors and reading deprecated docs before someone on Reddit told him to just find a modern tutorial. He was so frustrated he almost quit coding entirely but then he found a 2023 tutorial and it clicked way faster. Now he says that weekend of failure taught him more about React than any of his actual projects ever did.
5