In React,Class components are stateful, where state is attached to it and is maintained through renders.Functional components are stateless, having no state or logic attached to it.

For example:

Class component have state and which can be managed using constructor or lifecycle methods.

state={fetchData:[],Count: 0}componentDidMount() {this.setState({fetchData:[‘this’,’is’,’data’]})console.log(this.state.fetchData.count)}

Functional components only accepts props from its parent, and renders accordingly.It will not keep internal state that would be persistent between re-renders.So it renders by whatever is passed in props.To breakdown complex component into segments functional components are used as child components for rendering purpose.

What are…

Femina Brahmbhatt

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