useIsBrowser causes Invalid hook call. #6382
Replies: 4 comments 14 replies
-
|
You don't need to detect browser env in this case. The live preview isn't even enabled during SSR phase, AFAICT. Has it caused errors? Is the lib not even You should probably learn about hooks and their mental model? Alternatively, we also offer the |
Beta Was this translation helpful? Give feedback.
-
It seems not. If I import it in |
Beta Was this translation helpful? Give feedback.
-
|
Is it possible to turn off SSR as part of |
Beta Was this translation helpful? Give feedback.
-
|
A solution could be to convert your lib to a browser-only version: #5273 (comment) But if it's not a React component, I don't know, we should probably figure out a better solution |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm doing a fairly complex site involving the use of the the interactive code editor along with imports that aren't available for server side rendering.
I can get a working client side only site (usable via
yarn start) fairly simply but getting a build to work has given me a lot of trouble because of the server side rendering.I've attempted to use useIsBrowser for this roughly like this (inside the swizzled
ReactLiveScope\index.js):This give the following error during
yarn buildIn the browser, using
yarn startI get:Two questions:
Beta Was this translation helpful? Give feedback.
All reactions