From 6377d15ab879f4a2a06c49ec59af5f7cab4d71f3 Mon Sep 17 00:00:00 2001 From: hendraaagil Date: Tue, 8 Jun 2021 15:48:30 +0700 Subject: [PATCH] chore(root): fix warning `useLayoutEffect` ssr --- components/blog/Comments.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/blog/Comments.js b/components/blog/Comments.js index 5d95653..767a6ee 100644 --- a/components/blog/Comments.js +++ b/components/blog/Comments.js @@ -1,7 +1,17 @@ +import { useEffect, useState } from 'react'; import { ReactCusdis } from 'react-cusdis'; -const Disqus = ({ pageUrl, pageId, pageTitle }) => { +const Comments = ({ pageUrl, pageId, pageTitle }) => { const appId = process.env.NEXT_PUBLIC_CUSDIS_APPID; + const [show, setShow] = useState(false); + + useEffect(() => { + setShow(true); + }, []); + + if (!show) { + return null; + } return ( { ); }; -export default Disqus; +export default Comments;