<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mário Afonso</title>
    <description>The latest articles on DEV Community by Mário Afonso (@mario2211debug).</description>
    <link>https://dev.to/mario2211debug</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1256473%2Ffc51c6bd-615b-4fdb-b3a4-e9615f94fd3a.jpeg</url>
      <title>DEV Community: Mário Afonso</title>
      <link>https://dev.to/mario2211debug</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mario2211debug"/>
    <language>en</language>
    <item>
      <title>NextJs - ReactQuill ReferenceError: document is not defined</title>
      <dc:creator>Mário Afonso</dc:creator>
      <pubDate>Fri, 02 Aug 2024 10:31:30 +0000</pubDate>
      <link>https://dev.to/mario2211debug/nextjs-reactquill-referenceerror-document-is-not-defined-of7</link>
      <guid>https://dev.to/mario2211debug/nextjs-reactquill-referenceerror-document-is-not-defined-of7</guid>
      <description>&lt;p&gt;If you've ever tried to use ReactQuill's RichText, you've probably already faced this error:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ReferenceError: document is not defined&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If so, today I bring you good news, I managed to suppress the error by disabling SSR only for the ReactQuill component as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`import dynamic from 'next/dynamic'
ao invés de: import ReactQuill from “react-quill-new”, use o seguinte for a da função ou classe principal:
const DynamicHeader = dynamic(() =&amp;gt;  import("react-quill-new"), {  
ssr: false,
})
export default Mycomponent(){
  const [value, setValue] = useState&amp;lt;string&amp;gt;("");
return(
 /*ao inês de:
 &amp;lt;ReactQuill
                theme="snow"
                value={value}
                onChange={setValue}     /&amp;gt;
Use o seguinte: */ 
&amp;lt;DynamicHeader
                theme="snow"
                value={value}
                onChange={setValue}
              /&amp;gt;
}`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it, if it doesn't work give me feedback, if it works, it's the same, thanks for visiting!&lt;/p&gt;

&lt;p&gt;fonts:&lt;a href="https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#with-no-ssr" rel="noopener noreferrer"&gt;https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#with-no-ssr&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>reactquill</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
