React JS - Functional Components vs Class Components

Functional Components :

  • Introduced in React Version 16.8.
  • Mostly used
  • Easy
  • To create functional component default structure, we need to write shortcut rfc and press enter.

Class Components :

  • Used before React Version 16.8.
  • Rarely used
  • Complex
  • To create class component default structure, we need to write shortcut rce and press enter.
INTERVIEW QUESTION :

  • Which component does App.js file uses?
    Answer :
    Functional Component

  • Compare Functional Components & Class Components.

Comments