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.

ReferenceError: document is not defined

See original GitHub issue

Description I am facing “ReferenceError: document is not defined” When import import Stories from 'react-insta-stories'; in app.js React Native app. I have installed library into the project successfully from npm install --save react-insta-stories

What am i doing wrong?

Issue screenshot: Screenshot 2019-12-30 at 5 49 27 PM

My package.json

"react": "16.9.0",
"react-insta-stories": "^2.0.2",
"react-native": "0.61.5",

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
alexboatengcommented, Apr 18, 2020

In react applications with SSR and can be used by Lazy loading the component and disable SSR

import dynamic from "next/dynamic";

const DynamicComponentWithNoSSR = dynamic(() => import("../components/Stories"), {
  ssr: false,
});

export default () => <DynamicComponentWithNoSSR />;
1reaction
prafulrajhmcommented, Jun 22, 2020

Any solution for this?

I am facing same issue when I am using in Next.JS

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix ReferenceError: Document is not defined in ...
The most common reason for getting the reference error while on the browser is when you try to access the document object too...
Read more >
ReferenceError: document is not defined (in plain JavaScript)
Explanation: The error is caused because NextJs renders the page in the server only and in the server document (document is used inside...
Read more >
How to solve the document is not defined error
Here's how to fix the “referenceerror: document is not defined” error that you might have in Node.js or with a tool like Next.js....
Read more >
How To Fix ReferenceError document is not defined in ...
If you are trying to use the document object and receiving a ReferenceError: document is not defined error then there is a good...
Read more >
How to fix "ReferenceError: document is not defined" in ...
The most common reason for "document is not defined" error is that your JavaScript code is trying to access the document object in...
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