Difference between class and function based components in React.js

How to use Components in React.js?»

More often than not, there are always two groups of programmers when there are two choices available to do a thing. Same is the case here. Some programmers argue that function based components are easier to deal with than class based components. Other say, it is easier to read the code, make use of React States, implement inheritance and maintain the application lifecycle in a better way in class based components. I won’t argue which is better, both have its pros and cons. But I think the bottom line is that, for simpler tasks – use function based components and for complicated / complex ones (which is often the case) – use class based components.

Leave a Comment