Created
July 17, 2018 01:27
-
-
Save baptistemanson/60c74f66d3c9f2f1739a32b0b28c5a11 to your computer and use it in GitHub Desktop.
changing component with time
This file contains hidden or 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
// 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