#importing server component into client component works, but the beta docs says it doesn't work
10 messages · Page 1 of 1 (latest)
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>
);
}
but it doesn't work if the parent is client component
yep and thats not supposed to work
will it work in the future?
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
then i guess store data in local storage will not work well with ssr in app directory
time to use qwik
storing stuff in local storage wouldn't work with any ssr tech at all (react or not) because you can't read it from the server
if you need to read data from the client during ssr you can use cookies, the browser will send them with every request