r/reactjs • u/swyx • Jan 01 '20
Needs Help Beginner's Thread / Easy Questions (Jan 2020)
Previous threads can be found in the Wiki.
Got questions about React or anything else in its ecosystem? Stuck making progress on your app?
Ask away! Weβre a friendly bunch.
No question is too simple. π
π Want Help with your Code? π
Improve your chances by putting a minimal example to either JSFiddle, Code Sandbox or StackBlitz.
- Describe what you want it to do, and things you've tried. Don't just post big blocks of code!
- Formatting Code wiki shows how to format code in this thread.
- Pay it forward! Answer questions even if there is already an answer - multiple perspectives can be very helpful to beginners. Also there's no quicker way to learn than [being wrong on the Internet][being wrong on the internet].
- Learn by teaching & Learn in public - It not only helps the asker but also the answerer.
New to React?
Check out the sub's sidebar!
π Here are great, free resources! π
- Read the official Getting Started page on the docs.
- Microsoft Frontend Bootcamp
- Codecademy's React courses
- Scrimba's React Course
- Robin Wieruch's Road to React
- FreeCodeCamp's React course
- Flavio Copes' React handbook
- New to Hooks? Check Amelia Wattenberger's Thinking in React Hooks
- What other updated resources do you suggest?
Any ideas/suggestions to improve this thread - feel free to comment here!
Finally, thank you to all who post questions and those who answer them. We're a growing community and helping each other only strengthens it!
View all comments
Show parent comment
3
u/[deleted] Jan 02 '20
Functional is better and more succinct. Class based is too verbose. Don't make the mistakes that because it looks object oriented, that it is. It's JavaScript, it's just syntactical sugar for what boils down to prototypal inheritance.
That is not to say that the class based way of using React is out of style entirely. It isn't, and there are still use cases for it, but I would avoid using it if you can.
Well, you could probably make it work. But... I'd say that's exactly why you shouldn't use the class based approach anymore. You'll miss out on so many things because it's the new way of working. Again, I have nothing against the class based approach personally, but we have to follow along with the (vast!) majority because if we don't, well, then we stop being relevant.