question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v2] add a way to exclude components from SSR within JSX

See original GitHub issue

🚀 Feature

Add a way to exclude components from SSR in JSX. Maybe somethin like <NoSSR></NoSSR>.

Have you read the Contributing Guidelines on issues?

yes

Motivation

Right now, each time we use a react lib that doesn’t support SSR we have to put this check {typeof window !== 'undefined' && .... } everywhere inside js and mdx files.

Pitch

Tools like Next js and nuxt provide a way to exclude components from the SSR within the markup. To avoid errors during the build phase we should be able to do se same in a better way than using {typeof window !== 'undefined' && .... } or {typeof document !== 'undefined' && .... }.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
lex111commented, Feb 18, 2020

Fine, I wrote it on my todo list 📔

1reaction
yangshuncommented, Feb 18, 2020

Ok I think we can add that, but it is better named <ClientOnly>/<ClientRenderedOnly> rather than <NoSSR>.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Non-SSR Friendly Components with Next.js
Or else, you can create a wrapper component called NonSSRWrapper and then enclose any page in that component to disable SSR. import dynamic...
Read more >
Next js - disable server side rendering on some pages
Let's say Comments is our client only component. Now we need to render it only on the client. Here's how we do it....
Read more >
How to Disable Server-Side Rendering (SSR) in Next.js
Step 1: Rewrite All Requests to pages/index.js · Step 2: Disable SSR for Page Content · Step 3: Check that Everything Works with...
Read more >
A beginner's guide to React Server-Side Rendering (SSR)
In this lesson, we are going to talk about server-side rendering ... and an express server (Node.js) to demonstrate how SSR can be...
Read more >
How to implement server-side rendering in your React app in ...
Select FETCH AND RENDER. Once complete, click to see the result. 2. Improve performance. In SSR, the application performance depends on the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found