相关疑难解决方法(0)

Next.js ISR页面在CMS中删除后没有被删除

我正在尝试 Next.js 并构建一个小应用程序,该应用程序从安装了 GraphQL 的无头 WordPress 应用程序中获取帖子。然后我使用 Apollo/Client 来获取 GraphQL 内容:

apollo-client.js

import { ApolloClient, InMemoryCache } from "@apollo/client";

const client = new ApolloClient({
  uri: process.env.WORDPRESS_GRAPHQL_ENDPOINT,
  cache: new InMemoryCache(),
});

export default client;
Run Code Online (Sandbox Code Playgroud)

在索引中,我抓住了帖子:

索引.js

import Head from "next/head";
import styles from "../styles/Home.module.css";

import { gql } from "@apollo/client";
import Link from "next/link";
import client from "../apollo-client";

function Home(props) {
  const { posts } = props;
  return (
    <div className={styles.container}>
      <Head>
        <title>Wordpress blog posts</title>
        <meta
          name="description"
          content="Wordpress blog posts with …
Run Code Online (Sandbox Code Playgroud)

reactjs next.js getstaticprops getstaticpaths

5
推荐指数
1
解决办法
299
查看次数

标签 统计

getstaticpaths ×1

getstaticprops ×1

next.js ×1

reactjs ×1