Skip to content

Bug: The invalid value warning was showed when adding functions to object prototype #21091

@virtuous-code

Description

@virtuous-code

While adding a function to Object.prototype in React project anywhere, react while showing the Warning: Invalid value for prop `xxx` on tag. And an uncaught TypeError.

React version: 17.0.2

Steps To Reproduce

  1. Create a react project with create-react-app
  2. Put the following code anywhere in the project: Object.prototype.test = function () {}

图片

The current behavior

Getting the warning
图片
Also the Uncaught TypeError: renderer.setTraceUpdatesEnabled is not a function.
图片

The expected behavior

Expected nether warning nor error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions