Remix equivalent to next/dynamic? #3204
-
I have a client-sided react library I want to import which cannot be rendered on the server (the HTML editor react-draft-wysiwyg). |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Checkout |
Beta Was this translation helpful? Give feedback.
-
To import Editor form 'react-draft-wysiwyg' only on client side to avoid the "window is not defined' issue in Remix JS, you can use the useEffect hook as follows:
|
Beta Was this translation helpful? Give feedback.
-
Thanks @kiliman . This works for
|
Beta Was this translation helpful? Give feedback.
Checkout
remix-utils
<ClientOnly/>
https://github.com/sergiodxa/remix-utils#clientonly