#Client and Server component clarification
1 messages · Page 1 of 1 (latest)
@robust wing you mind telling us how you fixed it once you do? I'm a bit confused now as well and genuinely curious 🙂
Will do. Currently trying to deploy it yo see if it works live. Code seems all fine its just always telling me I am not signed in. Might be backend cookies issue so I want to try it on same domain production.
All works 🥳
Not entirely sure why the error above occured.. EIther Next automatically confimed it to client by seeing useState, or it was some kind of hot-reload bug. Either way, it thought my component is client component because the useState worked fine IIRC
Nice! So in the end you're able to have a SSR parent and a CSR child afterall?
Exactly. Moving onClick and useState logic into separste components and setting "use client" in them did the job. I would guess they are replaced by loading.js until client runs the code
That's very helpful to know thanks. I was kind of puzzled as to how/what/why/when SSR components should be used and wondering if I needed them at all. They made the change from SSG by default to SSR by default for a reason, which is a big change, and they recommend keeping it that way. It's becoming more clear to me now, I think these new patterns will encourage us to create smaller components