Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gatsby 防止Gatbsy中某些成分或语句的再水化_Gatsby - Fatal编程技术网

Gatsby 防止Gatbsy中某些成分或语句的再水化

Gatsby 防止Gatbsy中某些成分或语句的再水化,gatsby,Gatsby,我用盖茨比创建了一个小网站。现在我有一个相当简单的问题: 如何防止某些组件或语句重新水化?例如,如何在页脚中插入一个保持静态的生成日期时间 import * as React from 'react' interface FooterProps { className?: string } const Footer: React.FC<FooterProps> = ({ className }) => <footer className={className}&g

我用盖茨比创建了一个小网站。现在我有一个相当简单的问题:

如何防止某些组件或语句重新水化?例如,如何在页脚中插入一个保持静态的生成日期时间

import * as React from 'react'

interface FooterProps {
  className?: string
}

const Footer: React.FC<FooterProps> = ({ className }) => <footer className={className}>{new Date().toISOString()}</footer>

export default Footer
import*作为来自“React”的React
界面页脚道具{
类名?:字符串
}
常量页脚:React.FC=({className})=>{new Date().toISOString()}
导出默认页脚
不幸的是,显示的时间总是最新的,而不是生成页面的时间


提前谢谢你

我不知道这是否可能。但是盖茨比确实提供了一种通过graphql查询获取构建时间的便捷方法:

//index.js
从“React”导入React
从“盖茨比”导入{graphql}
导出默认值({data})=>(
{`我是在${data.site.buildTime}`构建的`}
)
export const query=graphql`
{
场地{
构建时间
}
}
`