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

ESLint warning in next.js codesandbox example #87

Open
aorumbayev opened this issue Dec 4, 2022 · 1 comment
Open

ESLint warning in next.js codesandbox example #87

aorumbayev opened this issue Dec 4, 2022 · 1 comment
Assignees
Labels
Enhancement New feature or request

Comments

@aorumbayev
Copy link

aorumbayev commented Dec 4, 2022

Hello Pera team, just wanted to report a small eslint warning regarding one of the next.js examples.

The following snippet from the codesandbox example on integration with next.js may potentially contain a typo:

  useEffect(() => {
    // Reconnect to the session when the component is mounted
    peraWallet
      .reconnectSession()
      .then((accounts) => {
        peraWallet.connector.on("disconnect", handleDisconnectWalletClick);

        if (accounts.length) {
          setAccountAddress(accounts[0]);
        }
      })
      .catch((e) => console.log(e));
  }, []);

Issue description form ESlint:

React Hook useEffect has a missing dependency: 'handleDisconnectWalletClick'. Either include it or remove the dependency array.eslint[react-hooks/exhaustive-deps](https://github.com/facebook/react/issues/14920)

In other words, the disconnect method has to be wrapped into a useCallback or dependency array removed completely.

@mucahit
Copy link
Contributor

mucahit commented Dec 14, 2022

@aorumbayev thanks!

@mucahit mucahit added the Enhancement New feature or request label Dec 14, 2022
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

3 participants