import React, { useEffect, useState } from "react";
import Cotter from "cotter"; // 1οΈβ£ Import Cotter
const [payload, setpayload] = useState(null);
// 2οΈβ£ Initialize and show the form
var cotter = new Cotter(API_KEY_ID); // π Specify your API KEY ID here
.withFormID("form_default") // Use customization for form "form_default"
.signInWithWebAuthnOrLink()
setpayload(response); // show the response in our state
.catch(err => console.log(err));
{/* 3οΈβ£ Put a <div> that will contain the form */}
<div id="cotter-form-container" style={{ width: 300, height: 300 }} />
<pre>{JSON.stringify(payload, null, 4)}</pre>