Skip to content

handleClickVariant is recreated on every render #101

@milesAraya

Description

@milesAraya

Problem

The problem: handleClickVariant is recreated on every render (line 360), causing the useCallback at line 622 to have
unstable dependencies. This triggers unnecessary re-renders and defeats the purpose of useCallback.

Impact: Causes child components to re-render unnecessarily, affecting performance.

Fix: Wrap handleClickVariant in its own useCallback with enqueueSnackbar as a dependency.

[eslint]
src/pages/AccountManager/index.tsx
Line 360:9: The 'handleClickVariant' function makes the dependencies of useCallback Hook (at line 622) change on every render. To fix this, wrap the definition of 'handleClickVariant' in its own useCallback() Hook react-hooks/exhaustive-deps

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions