fix script
This commit is contained in:
parent
fdff5a02d7
commit
70d3303bfa
@ -1,4 +1,4 @@
|
|||||||
import React from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { graphql, Script } from "gatsby";
|
import { graphql, Script } from "gatsby";
|
||||||
import config from '../../../data/site-config';
|
import config from '../../../data/site-config';
|
||||||
import Base from "../../components/Base";
|
import Base from "../../components/Base";
|
||||||
@ -20,7 +20,13 @@ const Comment = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Layout = ({ data, children }) => {
|
const Layout = ({ data, children }) => {
|
||||||
|
const [loadComment, setLoadComment] = useState(false);
|
||||||
|
|
||||||
const post = data.mdx.frontmatter;
|
const post = data.mdx.frontmatter;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setLoadComment(true)
|
||||||
|
}, [])
|
||||||
return (
|
return (
|
||||||
<Base>
|
<Base>
|
||||||
<div className="post template">
|
<div className="post template">
|
||||||
@ -41,7 +47,9 @@ const Layout = ({ data, children }) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Comment />
|
{ loadComment &&
|
||||||
|
<Comment />
|
||||||
|
}
|
||||||
</Base>
|
</Base>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user