#I cant figure the error out

7 messages · Page 1 of 1 (latest)

lunar spearBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

mellow scroll
#

i have my data stored in sessionStorage

#

im trying to get the info from it but im getting this error every time

#

Error: Objects are not valid as a React child (found: object with keys {error, reset}). If you meant to render a collection of children, use an array instead.

#

thats the hook code ```'use client'

import { useState, useEffect } from "react";

export default function useSession() {
const [user, setUser] = useState<Object | null>(null);

useEffect(() => {
    const user = sessionStorage.getItem("user");
    if (user) {
        setUser(JSON.parse(user));
    }
}, []);
return user;

}```

#

and thats the navbars code ```import "./custom-ui/navbarComponentStyles.css";
import Link from "next/link";
import useSession from "../hooks/useSessionStorage";

export default function Navbar() {
const user = useSession();
return (
<div>
<div>{user.nickname}</div>
<Link href={"/"}>
<button>Home</button>
</Link>
<br />
<Link href={"/login"}>
<button>Log out</button>
</Link>
</div>
);
}```