Last active
November 16, 2021 22:11
-
-
Save Mr-Kumar-Abhishek/a3c3b88bd432ac327b62730d2673e085 to your computer and use it in GitHub Desktop.
Pass props to stateless functional component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CurrentDate = (props) => { | |
return ( | |
<div> | |
{ /* Change code below this line */ } | |
<p>The current date is: {props.date } </p> | |
{ /* Change code above this line */ } | |
</div> | |
); | |
}; | |
class Calendar extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( | |
<div> | |
<h3>What date is it?</h3> | |
{ /* Change code below this line */ } | |
<CurrentDate date={Date()}/> | |
{ /* Change code above this line */ } | |
</div> | |
); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment