Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mr-Kumar-Abhishek/a3c3b88bd432ac327b62730d2673e085 to your computer and use it in GitHub Desktop.
Save Mr-Kumar-Abhishek/a3c3b88bd432ac327b62730d2673e085 to your computer and use it in GitHub Desktop.
Pass props to stateless functional component
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