From 70d3303bfa9dd4d6cc1e22977dca3afd54cf2af2 Mon Sep 17 00:00:00 2001 From: nc Date: Fri, 17 Feb 2023 13:59:12 +0700 Subject: [PATCH] fix script --- src/pages/Layout/index.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pages/Layout/index.tsx b/src/pages/Layout/index.tsx index d0f1071..b8d59ec 100644 --- a/src/pages/Layout/index.tsx +++ b/src/pages/Layout/index.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; import { graphql, Script } from "gatsby"; import config from '../../../data/site-config'; import Base from "../../components/Base"; @@ -20,7 +20,13 @@ const Comment = () => { } const Layout = ({ data, children }) => { + const [loadComment, setLoadComment] = useState(false); + const post = data.mdx.frontmatter; + + useEffect(() => { + setLoadComment(true) + }, []) return (
@@ -41,7 +47,9 @@ const Layout = ({ data, children }) => {
- + { loadComment && + + } ) }