Hi All,
I have a problem giving the Rich Text Components a type using @prismicio/types
library. I want to define the strong, h1, h2, h3, etc., and give each the right prop type.
The documentation is pretty minimalistic and confusing.
This is the code App.tsx:
import React from "react";
import "../styles/globals.css";
import Link from "next/link";
import type { AppProps } from "next/app";
import { PrismicLink, PrismicProvider } from "@prismicio/react";
import { PrismicPreview } from "@prismicio/next";
import { repositoryName } from "../prismicio";
import * as prismicT from "@prismicio/types";
const richTextComponents = {
strong: ({ children }: { children: prismicT.RTStrongNode }) => (
<strong className="font-semibold">{children}</strong>
),
};
const App = ({ Component, pageProps }: AppProps) => (
<PrismicProvider
richTextComponents={richTextComponents}
internalLinkComponent={({ href, ...props }) => (
<Link href={href}>
<a {...props} />
</Link>
)}
>
<PrismicPreview repositoryName={repositoryName}>
<Component {...pageProps} />
</PrismicPreview>
</PrismicProvider>
);
export default App;
Am I doing something wrong or using it wrong?