Created
October 24, 2023 20:24
-
-
Save sakshamchhimwal/4ae384d0c4239240da5bab7128b30ca0 to your computer and use it in GitHub Desktop.
Tasks Solution
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
// Location: app/(login)/login/page.tsx | |
"use client" | |
import { useState } from "react" | |
import LoginLayout from "./layout"; | |
export default function Page() { | |
const [name, setName] = useState("") | |
const [date, setDate] = useState(Date.now().toString()); | |
const [secs, setSecs] = useState(0); | |
setTimeout(() => { | |
const currTime = new Date(Date.now()); | |
setSecs(currTime.getUTCSeconds()); | |
setDate(currTime.toTimeString()); | |
}, 1000); | |
return ( | |
<> | |
<input type="text" onChange={(e) => { setName(e.target.value) }} /> | |
<br /> | |
<div>{name === "" ? "Hello" : name}</div> | |
<div>Seconds: {secs}</div> | |
<div>Date: {date}</div> | |
</> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment