Created
September 28, 2021 09:44
-
-
Save BjornDCode/43482159a73f038a40ea4652774c898b to your computer and use it in GitHub Desktop.
Reform in NextJS
This file contains 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 { useEffect } from 'react' | |
import Script from 'next/script' | |
export default function Home() { | |
useEffect(() => { | |
window.Reform=window.Reform||function(){(Reform.q=Reform.q||[]).push(arguments)}; | |
window.Reform('init', { | |
url: '', // Form URL | |
target: '#my-reform', | |
}) | |
}, []) | |
return ( | |
<div> | |
<Script | |
id="reform-script" | |
src="https://embed.reform.app/v1/embed.js" | |
strategy="afterInteractive" | |
/> | |
<main> | |
<div id="my-reform"></div> | |
</main> | |
</div> | |
) | |
} |
Quick fix is likely to just define
declare const Reform: any
At the top of the file.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ BjornDCode Thought I'd send a FYI the above gist. When running Next with TypeScript this version doesn't work since TS doesn't recognize
Reform.q
etc. I'm exploring fixes atm.