Code from Episode 15 Scrimba, Intro to React.
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"
}
//define styles using an object literal
const styles = {
color: "#FF8C00",
backgroundColor: "#FF2D00",
fontSize: "200px"
}
//add inline style to JSX element
return (
<h1 style={styles}>Good {timeOfDay}!</h1>
)
}
ReactDOM.render(<App />, document.getElementById("root"))