#importing server component into client component works, but the beta docs says it doesn't work

10 messages · Page 1 of 1 (latest)

fleet trout
#

It works if the parent component is a server component

#

from the docs

// app/page.js
// ✅ This pattern works because page.js is a server component
import ClientComponent from "./ClientComponent";
import ServerComponent from "./ServerComponent";

// Pages are Server Components by default
export default function Page() {
  return (
    <ClientComponent>
      <ServerComponent />
    </ClientComponent>
  );
}
azure wasp
#

but it doesn't work if the parent is client component

fleet trout
#

yep and thats not supposed to work

azure wasp
inner cave
#

I don't think so, it wouldn't make sense because if your component must run in the browser you can't include things exclusive from the server there

azure wasp
#

time to use qwik

inner cave
#

if you need to read data from the client during ssr you can use cookies, the browser will send them with every request