'How to dynamically import a component in gatsby [duplicate]
I am trying to import a component onto a page and the component uses a package that uses the window property. So, I need to dynamically import the component.
How can I do the following with Gatsby? (This is in NextJS)
import dynamic from 'next/dynamic';
...
const MyComponent = dynamic(() =>
import('path').then((comp) => comp.default),
);
Solution 1:[1]
You need to append your js script to your component. window property is not native.
Check it, for example, here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | illia chill |
