Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function useLocalRemarkForm(
markdownRemark: RemarkNode | null | undefined,
formOverrrides: Partial> = {}
): [RemarkNode | null | undefined, Form | string | null | undefined] {
const [values, form] = useRemarkForm(markdownRemark, formOverrrides)
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore form can be `null` and usePlugins doesn't like that.
usePlugins(form)
return [values, form]
}
export function useGlobalRemarkForm(
markdownRemark: RemarkNode | null | undefined,
formOverrrides: Partial> = {}
): [RemarkNode | null | undefined, Form | string | null | undefined] {
const [values, form] = useRemarkForm(markdownRemark, formOverrrides)
usePlugins(
React.useMemo(() => {
if (form) {
return new GlobalFormPlugin(form, null)
}
}, [form])
)
return [values, form]
}