Functional or class based components?


I would like to add some features to Jitsi Meet. I’ve read the introduction located at:

but found no hit should new components be:

a) class based - like most of the current code

b) or functional (the direction React is currently pursuing


This is a debate we haven’t solved :slight_smile:
We used to use functional components only for simple stateless stuff. As we were doing some optimizations around re-rendering for 500 participant calls, I would say if you have a lot of state use class-based. If you have less state - let’s say 1 or 2 fields from the store use functional.

well after the hooks API has been introduced it seams that functional components are also the advised way to do stateful components

so maybe the optimal approach should be:

  • all new components should be function
  • large rewrites / refactors of old components should also turn then into functional components


1 Like