Skip to content

Instantly share code, notes, and snippets.

@baptistemanson
Created July 17, 2018 01:27
Show Gist options
  • Save baptistemanson/60c74f66d3c9f2f1739a32b0b28c5a11 to your computer and use it in GitHub Desktop.
Save baptistemanson/60c74f66d3c9f2f1739a32b0b28c5a11 to your computer and use it in GitHub Desktop.
changing component with time
// css is
// .day {color: black; background-color:white}
// .night {color: white; background-color:blue}
const DivChanging = ({ text }) => {
if (new Date().getHours() > 12) {
return <div class="night">{text}</div>;
} else {
return <div class="day">{text}</div>;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment