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

Small issue on example #132

Closed
gitnan opened this issue Feb 15, 2023 · 2 comments
Closed

Small issue on example #132

gitnan opened this issue Feb 15, 2023 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers

Comments

@gitnan
Copy link

gitnan commented Feb 15, 2023

Describe the bug
React Hook useCallback has missing dependencies: 'executeRecaptcha'

To Reproduce

  const handleSubmit = useCallback(async (e) => {
    e.preventDefault();

    // Generate ReCaptcha token
    const token = await executeRecaptcha("form_submit");

    // Attach generated token to your API requests and validate it on the server
    fetch("/api/form-submit", {
      method: "POST",
      body: {
        data: { name },
        token,
      },
    });
  }, []);

Expected behavior
Correct me if I am wrong, however the [] in your example, (last line of above code snippet) would need to be:
[executeRecaptcha, name]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@snelsi
Copy link
Owner

snelsi commented Feb 15, 2023

I originally didn't add it on purpose, actually. So as not to overcomplicate the code. But maybe it will actually make more sense to add it 🤔

@snelsi snelsi self-assigned this Feb 15, 2023
@snelsi snelsi added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers labels Feb 15, 2023
@gitnan
Copy link
Author

gitnan commented Feb 15, 2023

Yeah its probably worth having, so someone using the example if they are using different names it would make it easier for them to know what to change etc, just a suggestion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants