Created
October 4, 2019 07:18
-
-
Save vicradon/658b6c9ecc582119985f7647099fb13f to your computer and use it in GitHub Desktop.
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
import React from "react" | |
import ReactDOM from "react-dom" | |
function App(){ | |
let style = { | |
fontSize:"4rem" | |
} | |
let date = new Date(2019, 10, 4, 22); | |
const hours = date.getHours(); | |
let timeOfDay = "Morning"; | |
if (hours < 12){ | |
timeOfDay = "Morning"; | |
style.color = "orange"; | |
} | |
else if (hours >= 12 && hours < 17){ | |
timeOfDay = "Afternoon"; | |
style.color = "red"; | |
} | |
else{ | |
timeOfDay = "Night"; | |
style.color = "blue"; | |
} | |
return (<h1 style = {style}>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