33
loading...
This website collects cookies to deliver better user experience
const DemoFunciton = () => {
const Name = "Amirul Islam Shanto";
return (
// jsx start here
<div>
<h1> My Name Is {Name} .</h1>
<h5> I Am A MERN Stack Developer.</h5>
</div>
);
};
getInitialstate(): executed before the creation of the component.
componentDidMount(): executed when the component is rendered on the DOM.
shouldComponentUpdate(): executed when a component determines changes to the DOM and returns a “true” or “false” value based on certain conditions.
componentDidUpdate():it executed after rendering takes place.
componentWillUnmount(): it is executed before a component is destroyed and unmounted permanently.
//Functional component
import React from 'react';
const DemoComponent = () => {
return (
<div>
<h1>This is Functional component..</h1>
</div>
);
};
export default DemoComponent;
//Class Component
import React, { Component } from 'react';
class DemoComponent extends Component {
render() {
return (
<div>
<h1>This is class component..</h1>
</div>
);
}
}
export default DemoComponent;