zenoamaro / react-quill

A Quill component for React.
https://zenoamaro.github.io/react-quill
MIT License
6.72k stars 915 forks source link

ReactQuill, NextJS and SSR #1000

Open alilland opened 3 weeks ago

alilland commented 3 weeks ago

This isnt a new topic, I can see the solution others have done to implement ReactQuill together with NextJS, however my issue is a little more nuanced.

I use ReactQuill to not only write blogs but I use it to display them as well (unless there is a better solution to display delta's)

In my server side NextJS page I import my component housing 'react-quill' using dynamic import

const TextEditor = dynamic(() => import('@/components/inputs/TextEditor'), { ssr: false })

The problem with this is I lose the benefit of SSR almost entirely, the reason for SSR is for caching articles. Not all search engines are good at rendering Javascript. I also get lower get lower ranking points with "First to Paint" being slower now because the article is rendered on the client side.

is there a way to "spoof" document on server side and trick it into rendering HTML components on the server side? Or is there an alternative rendering library I can use for rendering my stored JSON delta structure? { ops: [...] }