Skip to content

Commit

Permalink
feat(sdd): prvent duplicate render of veriff modal
Browse files Browse the repository at this point in the history
  • Loading branch information
milan-bc committed Dec 20, 2020
1 parent 890f924 commit 9f13c9d
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { createVeriffFrame } from '@veriff/incontext-sdk'
import { useEffect } from 'react'
import { useEffect, useState } from 'react'

function Success ({ handleVeriffMessage, url }) {
const [isActive, setIsActive] = useState(false)
useEffect(() => {
createVeriffFrame({
url,
onEvent: handleVeriffMessage
})
}, [])
if (!isActive) {
createVeriffFrame({
url,
onEvent: handleVeriffMessage
})
setIsActive(true)
}
}, [isActive])

return null
}
Expand Down

0 comments on commit 9f13c9d

Please sign in to comment.