marsidev / react-turnstile

Cloudflare Turnstile integration for React.
https://www.npmjs.com/package/@marsidev/react-turnstile
MIT License
396 stars 25 forks source link

how to refresh turnstile when click the button? #23

Closed epubreader closed 1 year ago

epubreader commented 1 year ago

how to refresh turnstile when click the button?

marsidev commented 1 year ago

Hey! Do you mean resetting the widget upon a success callback? You can use the ref to reset the widget.

const ref = React.useRef()

return <Turnstile ref={ref} siteKey={siteKey} onSuccess={() => ref.current?.reset()} />