0

而不是从同一存储库中的我的 mdx 文件中检索数据。

我可以更新/修改 mdx 文件中的值吗?

当用户加载此页面时,我想更新mdx 文件中的readCount值。

我需要包还是只有 javascript 才能做到这一点?

// blogName.mdx
import BlogPost from "@/components/templates/Blogs/index";

export const meta = {
  title: "Blog Title",
  description: "Blog description string",
  date: "Aug 04, 2020",
  readCount: 2,
};

export default ({ children }) => <BlogPost meta={meta}>{children}</BlogPost>;

# Markdown Blog Title

上面的 mdx 将在下面的组件中使用。

/* 
    Next.js Framework 
    @/components/templates/Blogs/index    
*/


import React, {useEffect} from "react";

const index = () => {
  
  useEffect(() => {
     // update meta value in here

  })
  
}


4

0 回答 0