Next.js Discord

Discord Forum

How can I force a CSR if SSR errors?

Unanswered
Oak shoot sawfly posted this in #help-forum
Open in Discord
Oak shoot sawflyOP
My whole app blows up if one of my components throw an error, am I able to instead force a CSR in this case?

4 Replies

@Oak shoot sawfly My whole app blows up if one of my components throw an error, am I able to instead force a CSR in this case?
yes, you can skip SSR while using lazy loading it:
const ComponentC = dynamic(() => import('../components/C'), { ssr: false })
@Oak shoot sawfly solved?
@B33fb0n3 <@376504725446721536> solved?
Oak shoot sawflyOP
Uh nah I was wondering if I could make it so my components SSR, but if they throw an error then it retries on the client with CSR, similar to what Suspense achieves but at an app level