Home > Back-end >  I want to know what I can do with class based components that I cannot do with function based
I want to know what I can do with class based components that I cannot do with function based

Time:08-27

I have started learning reactjs and I am loving it, my query is, is there anything I can do with class-based components that I can't with function based? I know the concept of classes in JS and I am pretty comfortable using classes but in react I felt that function-based components are much easier to learn.

CodePudding user response:

As long as I know, only class components can become error boundaries, the rest both function and class components can do the same.

See: https://reactjs.org/docs/error-boundaries.html

CodePudding user response:

Class components are also often used as singletons

  • Related