I need to integrate the google form inside my gatsby application. In onsubmit I have opened the google form. Once after filling the form details after submitting the form I need to take user to home page. I have tried using useNavigate and history I couldn't able to navigate the page to home. Can anyone guide me how to achieve this. Thanks in advance.
function GoogleLink() {
let navigate = useNavigate()
let openFrame = () => {
let iframe = document.createElement("iframe")
iframe.src = `googleform link`
iframe.frameBorder = "0"
iframe.id = "iframe"
iframe.style.position = "absolute"
iframe.style.zIndex = "999"
iframe.style.height = "100%"
iframe.style.width = "100%"
iframe.style.top = "0"
iframe.style.backgroundColor = "white"
iframe.style.border = "none"
document.body.prepend(iframe)
document.body.style.overflow = "hidden"
}
const handleSubmit = () => {
openFrame()
navigate("/home")
}
return (
<Layout>
<div>
<Row>
<Col>
<Button onClick={handleSubmit}>Click Here</Button>
</Col>
</Row>
</div>
</Layout>
)
}