-
Notifications
You must be signed in to change notification settings - Fork 923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server-Side Rendering (SSR), NextJS, etc. #919
Comments
The component should be called like this: import dynamic from 'next/dynamic'
const DynamicQuill = dynamic(() => import('react-quill'), { ssr: false }) And already in the code itself:
|
@wolfcreative thanks, yes, dynamically importing the code in NextJS with ssr: false will make sure it runs clientside only. |
I'd think you better encapsulate a wrapper than the react-quill itself.
Then you can do whatever you want in the Editor module, it will only be rendered on the client. |
Here is React SSR Solution if some one need
|
how to register custom module like quill emoji? |
Anyone here who is looking to purely render Quill rich text, you can use quill-delta-to-react. The library supports all the native Quill formats as well as custom elements and provides a lot of control over the rendering. |
📌 Pinning this issue as a response to anyone looking for support rendering Quill in NextJS, Remix, Gatsby, Astro etc. via server-side rendering.
Quill requires a full DOM - you can't render it without a reference to
document
. Additionally, if you do server-side render the editor, the DOM will be reset when it initializes the Quill instance clientside. So the best workaround is to skip rendering the ReactQuill component in SSR, and render a fallback element like a <textarea> instead.NextJS-specific workarounds have been discussed here: #897
Previous issues - please read before creating a new one:
https://github.com/zenoamaro/react-quill/issues?q=is%3Aissue+document
#917 #718 #648 #699 #894 #863 #292 #910
The text was updated successfully, but these errors were encountered: