score:1

Accepted answer

you're mounting veriff.mount() before the page is loaded so the root element cannot be found.

wrap it in a useeffect()

useeffect(() => {

veriff.mount()

return () => {

  //then unmount
  veriff.unmount()

}
// this renders once when there isn't an input
}, [])

should do the trick also, don't forget to

import react, {usestate, useeffect} from 'react'

score:0

you must to import veriff as named import

import {veriff} from "@veriff/js-sdk";

score:2

i've been messing with this for some time, and realized that the imported object import veriff from "@veriff/js-sdk actually isn't a function, rather it's an object that contains a function. it returns {veriff:𝑓}, so basically you need to call veriff.veriff(options) instead of just veriff(options). for me, typescript did not allow this, so i had to do const veriff = require("@veriff/js-sdk) instead of the es6 import. hope this helps someone and the veriff team refactor this either in the documentation or code.


Related Query

More Query from same tag