When would you use a class component over a functional component?



When would you use a class component over a functional component?..

Answer / Ambuj Kumar Verma

Class components provide more features like state management, lifecycle methods, and refs. You might choose to use a class component when your component requires these advanced features or needs to access DOM directly.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More React.js Interview Questions

What is flux?

1 Answers  


How to apply validation on props in reactjs?

1 Answers  


How react router and its techniques differ from more traditional javascript routers like backbone’s router?

1 Answers  


When reactjs released?

1 Answers  


What is one of the core types in react?

1 Answers  


What is ReactDOM and what is the difference between ReactDOM and React?

1 Answers  


What is the virtual dom, and a pragmatic overview of how react renders it to the dom in react.js?

1 Answers  


Is it possible to nest jsx elements into other jsx elements?

1 Answers  


How to dispatch the data in-store?

1 Answers  


What is react js good for?

1 Answers  


What are the pros and cons of using React?

1 Answers  


Can JSX element be attached to other JSX components?

1 Answers  


Categories