#Are you guys using server components in production ?
17 messages · Page 1 of 1 (latest)
🔎 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)
yea, it can be a good idea to display your pages (tables included) as server component
What about pagination and search with it
yea, is also be fine
used to display heave components, like: tables with pagination,
maps, secondary frames etc..
very useful when need to increase webiste performance
but be careful with it
@cold swallow
@cold swallow what are things I should be card
be careful not to include any code that relies on client-side features like window or document.
server components can reduce client side js bundle size, but they might increase server load.
Just some things to note:
-
You literally cannot have window or any interactive stuff in server side code, react wont allow it so you dont need to be extra careful yourself
-
Client components are also server side rendered just that their interactive side is hydrated on the client
yep
@cold swallowsolved?
2). point is not always true. The client components won't always be server rendered. They won't be rendered incase if you're using react hooks like useEffect, useContext, useState, etc or accessing browser APIs. You can always cross check this by inspecting View Source section of webpage in browser.
client components are, in fact, server side rendered. @/Clown was right. see also: Why do Client Components get SSR'd to HTML? by Dan Abramov, former? member of the React team.
useContext is prerendered on the server using the initial value of the context.
useState is also prerendered, using the initial value of the state.
using browser APIs requires useEffect.
useEffect is not prerendered because it only runs after the first browser rendering is finished.
@daring crypt So Why don't I see the Raw HTML Data in View Source if I'm using these hooks in the perticular components!
your code bug, possibly. without seeing your code i can't guess.
if you want it debugged, i suggest opening a new #1007476603422527558 post where people can come see why your component is not being server rendered.
in the meantime i will give you this:
https://github.com/joulev/debug/blob/nextjs-client-component-ssr-example/app/client-components.tsx
https://debug-git-nextjs-client-component-ssr-example-joulev-proj.vercel.app