react give compenet class code example
Example 1: create react component class
class MyComponent extends React.Component{
constructor(props){
super(props);
};
render(){
return(
My First React Component!
);
}
};
Example 2: functional components react
function Comment(props) {
return (
{props.author.name}
{props.text}
{formatDate(props.date)}
);
}