Skip to content

Instantly share code, notes, and snippets.

@BolajiAyodeji
Last active August 25, 2019 23:32
Show Gist options
  • Save BolajiAyodeji/1127adde936d8b2de2272ccb2846f0fc to your computer and use it in GitHub Desktop.
Save BolajiAyodeji/1127adde936d8b2de2272ccb2846f0fc to your computer and use it in GitHub Desktop.
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