DEV Community

Discussion on: Top Interview Questions for Frontend Developers(React)

Collapse
 
deepanshu44 profile image
deepanshu44 • Edited

Does class components and their lifecycle methods hold any importance presently?
Should I study them for interview or functional components and hooks are enough?

Collapse
 
abhishekraj272 profile image
Abhishek Raj

You should know class components & all lifecycle methods and their alternative in hooks, functional components + hooks are important as well.

Reason: My codebases or some part of codebases are still written using class. So, companies sometime ask those question too. Be ready for any question, you don't know what companies are using under the hood.

Cheers :)

Collapse
 
deepanshu44 profile image
deepanshu44

thanks

Collapse
 
ortonomy profile image
🅖🅡🅔🅖🅞🅡🅨 🅞🅡🅣🅞🅝

You should know class-based components - but I would pretty much avoid using them in almost all cases for new code. The only time I know of to use them is without a choice - when you need to implement an Error boundary - the react docs still specify the API as a class component.