Skip to content

[Typo]: "A stopwatch" example for useRef does not cleanup correctly #7255

@jacobgmathew

Description

@jacobgmathew

Summary

In "A stopwatch" example for useRef an interval is set in handleStart(). It is cleared in handleStop(). But if the component is unmounted after the interval is started, but without stopping it, it is never cleared, which means setNow can get called on an unmounted component.

Page

https://react.dev/reference/react/useRef#examples-value

Details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions