fix script

This commit is contained in:
nc 2023-02-17 13:59:12 +07:00
parent fdff5a02d7
commit 70d3303bfa

View File

@ -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 (
<Base>
<div className="post template">
@ -41,7 +47,9 @@ const Layout = ({ data, children }) => {
</div>
</div>
</div>
<Comment />
{ loadComment &&
<Comment />
}
</Base>
)
}