React Component Types(Latest)

Gaurav Singh
1 min readJun 27, 2021
React Component Types

To define a component, React provides us two JS syntax :
Function Based Component and Class Based Component.

Before React Hooks were introduced, Functional Component were just used as a presentational component with an option of props available to them to render any UI. They did not had any local state at their disposal. Functional Components are just JavaScript functions that return a description of their user interface.

We can use Class Based Component to manage state, perform side effects like loading data and working with DOM or responding to DOM event directly.

With the addition of hooks in React, now we can use functional component to manage state and side effects.

Note : Pure Components In React(React.PureComponent) are just a type of class based component where these components run shouldComponentUpdate by default during every re render phase. Don’t consider them as different types but as a subset of class based component.

--

--