React Class vs React Function

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:

  1. A react function is a plain javascript function but react class component is an extended class component
  2. React function component is a stateless component but react class component is a stateful component
  3. React functions use React hooks whereas react class components use react lifecycle methods
  4. 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
  5. React class components require a render() method and by default contains a constructor method while react function requires none.
  6. 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.

--

--

--

Technical Writer, Software Developer, Blogger, and Career Development Coach…

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Component-Driven Responsive Design Using Container and Scope CSS Queries

Using console in Javascript for better testing | Apiumhub

Housekeeping task - Post POD formation and before a POD dies

Secure storage of OAuth2 tokens in client-side applications and SPAs

How to use Glide with React

Migrating React Native app to React Hooks

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chanchala Gorale

Chanchala Gorale

Technical Writer, Software Developer, Blogger, and Career Development Coach…

More from Medium

REACT (PART-2)…

React Redux overview

React Exploration