Created
July 1, 2021 21:20
-
-
Save dayhaysoos/b7c0d2cc3929b969ad1e4b35d3dbc69c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import { useMemo } from "react"; | |
import { RichTextField } from "@prismicio/types"; | |
import { asText } from "@prismicio/helpers"; | |
export type PrismicTextProps = { | |
field: RichTextField; | |
separator?: string; | |
}; | |
export const PrismicText = (props: PrismicTextProps): JSX.Element => { | |
const text = useMemo( | |
() => asText(props.field, props.separator), | |
[props.field, props.separator], | |
); | |
return <>{text}</>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment