Skip to content

Unnecessary Re-renders in SearchBox Component #53

@pawansoni007

Description

@pawansoni007

Issue Description

The SearchBox component in our application is re-rendering every second due to a timer in its parent component (Playground), even when the search state hasn't changed. This may lead to performance issues, especially with larger datasets or more complex rendering logic.

Current Behavior

  1. The usePlayground hook in Playground sets up a timer that updates timeLeft every second.
  2. This causes Playground to re-render every second.
  3. Consequently, SearchBox re-renders every second, despite its props (search and setSearch) not changing.

Expected Behavior

SearchBox should only re-render when its props (search or setSearch) actually change, not on every tick of the parent component's timer.

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