Skip to content

[Typo]: Code example mistake in useMemo page #7252

Open
@khkh0109

Description

Summary

There is a mistake in the ChatRoom example code on the useMemo page, specifically in the 'Preventing an Effect from firing too often' section.

Page

https://react.dev/reference/react/useMemo#preventing-an-effect-from-firing-too-often

Details

There are two mistakes in the ChatRoom example under the 'Preventing an Effect from firing too often' section:

  1. The line const options = createOptions() suddenly appears in the code without context. It seems like this should be removed.
  2. In the comment 'Only changes when createOptions changes', the reference to 'createOptions' should be replaced with 'options object'. This is because options is the actual dependency in the useEffect.

Screenshot of typo:
스크린샷 2024-10-24 오후 7 28 57

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