Skip to content

ESLint warning in next.js codesandbox example #87

@aorumbayev

Description

@aorumbayev

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.

Metadata

Metadata

Assignees

Labels

EnhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions