marsidev / react-turnstile

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

Explicitly rendering Turnstile widget #11

Closed joshtblack closed 1 year ago

joshtblack commented 1 year ago

Hi there, is it possible to explicitly render Turnstile so I can get a token via lets say clicking a login button rather than getting a token on component render instead? Especially as I am using the invisible widget type.

Thank you!

marsidev commented 1 year ago

Hey! Sure, you can interact with the widget using a ref to get the token, as shown here.

Also check out this demo using the invisible widget type.

joshtblack commented 1 year ago

Great, thanks!