diff --git a/app/page.tsx b/app/page.tsx index e396bc7..bc874a7 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,113 +1,29 @@ -import Image from 'next/image' +"use client" +import { useEffect, useId, useState } from "react"; export default function Home() { + const id = useId() + const [name, setName] = useState(''); + + useEffect(() => { + if (typeof window !== "undefined" && window.localStorage) { + let name = localStorage.getItem("name"); + console.log("Got name", name); + setName(name); + } + }, []); + + function saveName(name: string) { + setName(name); + if (typeof window !== "undefined" && window.localStorage) { + localStorage.setItem("name", name); + } + } + return ( -
-
-

- Get started by editing  - app/page.tsx -

-
- - By{' '} - Vercel Logo - -
-
- -
- Next.js Logo -
- -
- -

- Docs{' '} - - -> - -

-

- Find in-depth information about Next.js features and API. -

-
- - -

- Learn{' '} - - -> - -

-

- Learn about Next.js in an interactive course with quizzes! -

-
- - -

- Templates{' '} - - -> - -

-

- Explore starter templates for Next.js. -

-
- - -

- Deploy{' '} - - -> - -

-

- Instantly deploy your Next.js site to a shareable URL with Vercel. -

-
-
+
+ + saveName(e.target.value)}>
) }