Next.js Discord

Discord Forum

does dynamic / ssr:false not work with app router?

Unanswered
Old English Sheepdog posted this in #help-forum
Open in Discord
Old English SheepdogOP
literally just does load the chunk. ex:

"use client";

import dynamic from "next/dynamic";
import { useState } from "react";

const DynamicComponent = dynamic(import("../components/my-component"), {
  ssr: false,
});

export function Intermediary() {
  const [show, setShow] = useState(false);
  return (
    <>
      <button onClick={() => setShow((oldShow) => !oldShow)}>show</button>
      {show && <DynamicComponent />}
    </>
  );
}

1 Reply

Old English SheepdogOP
anyone else run into this?