Last active
August 25, 2019 23:32
-
-
Save BolajiAyodeji/1127adde936d8b2de2272ccb2846f0fc to your computer and use it in GitHub Desktop.
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
import React from "react" | |
import ReactDOM from "react-dom" | |
function App() { | |
const date = new Date() | |
const hours = date.getHours() | |
let timeOfDay | |
if (hours < 12) { | |
timeOfDay = "morning" | |
} else if (hours >= 12 && hours < 17) { | |
timeOfDay = "afternoon" | |
} else { | |
timeOfDay = "night" | |
} | |
return ( | |
<h1>Good {timeOfDay}!</h1> | |
) | |
} | |
ReactDOM.render(<App />, document.getElementById("root")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment