DEV Community

sakethk
sakethk

Posted on

Try to use functional component over class component in react

  1. Functional component are much easier to read.
  2. Class components are stateful while Functional are stateless.
  3. You end up with less code. Fewer lines = better performance
  4. It will get easier to separate container and presentational components because you need to think more about your component’s state if you don’t have access to setState() in your component
  5. Class component has lifecycle it has to run the lifecycle methods where functional components doesn't have any life c
  6. No need of this
  7. React dev team said that there may be a performance boost for functional component in coming versions.

Top comments (1)

Collapse
 
christopherkapic profile image
CK

100% worth using functional components, even if the only reason is readability (assuming all other factors are equal).