Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset component by using ref.current.reset() #7

Closed
exdeusdev opened this issue Nov 18, 2022 · 1 comment
Closed

Reset component by using ref.current.reset() #7

exdeusdev opened this issue Nov 18, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@exdeusdev
Copy link

Hi, how i can pas ref into Turnstile component ?
For an example:

import { useRef } from "react";
import Turnstile from "react-turnstile";

const TurnstileWidget() {
  const ref = useRef(null)
  return (
    <Turnstile
      ref={ref}
      sitekey="1x00000000000000000000AA"
      onVerify={(token) => alert(token)}
    />
  );
}

So i can call reset function with ref.current.reset()

Already following this guide How to get widget id?, but i want more clean code to handle the component. I think it would be great and can support remove, getResponse.
Thankyou 👍

@Le0Developer Le0Developer added the enhancement New feature or request label Nov 18, 2022
@Le0Developer Le0Developer self-assigned this Nov 18, 2022
@Le0Developer
Copy link
Owner

Published in v1.0.6 just now.

Note that the correct call to reset turnstile is turnstile.reset(ref.current);, not ref.current.reset();.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants