React Class vs React Function
1 min readJul 22, 2021
As you start exploring react you can see that you have a choice to use either functional or class components:
Support: https://reactjs.org/docs/getting-started.html
Before you start using one particular component you should try using each component and see its plus and minus points.
I tried and below are some points which can help you:
- A react function is a plain javascript function but react class component is an extended class component
- React function component is a stateless component but react class component is a stateful component
- React functions use React hooks whereas react class components use react lifecycle methods
- React function components can use react hooks as many times as required but you can use the react lifecycle method only once in a react class components
- React class components require a render() method and by default contains a constructor method while react function requires none.
- React class components need to bind() with the child functions with this keyword or use the arrow function, function components don't have to bind.