menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

When to us...
source image

Dev

2w

read

227

img
dot

Image Credit: Dev

When to use a Class Component? When to use a Function Component?

  • Before React 16.8, class components were recommended for using lifecycle methods.
  • After React 16.8, functional components with hooks became the new best practice.
  • Class components were used for componentDidMount, componentDidUpdate, and componentWillUnmount.
  • Functional components with useState() and useEffect() can now achieve the same as class components, leading to their widespread adoption.

Read Full Article

like

13 Likes

For uninterrupted reading, download the app