Search code examples
reactjsreact-functional-componentreact-class-based-component

What is the difference between rcc and rfc in react?


I want a use case example of when react class components are needed for a project over a react functional component and vise versa. I cant seem to understand the difference between the two.


Solution

  • It’s mostly historical. React components were originally all class components. Function components were introduced in a later version of React. Going forward you should use function components.