#How can I prevent all pages from becoming dynamic?

3 messages · Page 1 of 1 (latest)

knotty onyx
#

Here is what I am trying to acheive

import Image from "next/image";
import Link from "next/link";

export default function Home() {
  // basically hook which check for auth user
  const loggedUser = false;
  return (
    <main className="flex flex-col items-center mt-12">
      <h1 className="font-semibold text-4xl">Website</h1>
      {loggedUser ? (
        // will be dynamic based on user
        <div>Welcome back Mubashir</div>
      ) : (
        // should be statically generated for better speed at build time 
        <div className="flex gap-8">
          <Link href="/login">Login</Link>
          <Link href="/signup">Signup</Link>
        </div>
      )}
    </main>
  );
}

the much I understand if I add hook which checks for loggedin user all the child pages will be dynamically generated.
What can be done or what am I doing wrong?

languid ruinBOT
#

🔎 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)

knotty onyx
#

I will create two components for pages but the point is i have the auth hook at the top would not it make every child component dynamically generate