Home / Function/ decorate() — react Function Reference

decorate() — react Function Reference

Architecture documentation for the decorate() function in utils.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  8d525387_a769_cab0_bdee_c60c6b36abc5["decorate()"]
  8279557a_7bce_460a_8a5c_d1a3e46f96c0["utils.js"]
  8d525387_a769_cab0_bdee_c60c6b36abc5 -->|defined in| 8279557a_7bce_460a_8a5c_d1a3e46f96c0
  25f0e20e_3849_3b03_9630_fb8108361c04["decorateMany()"]
  25f0e20e_3849_3b03_9630_fb8108361c04 -->|calls| 8d525387_a769_cab0_bdee_c60c6b36abc5
  style 8d525387_a769_cab0_bdee_c60c6b36abc5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/backend/legacy/utils.js lines 12–19

export function decorate(object: Object, attr: string, fn: Function): Function {
  const old = object[attr];
  // $FlowFixMe[missing-this-annot] webpack config needs to be updated to allow `this` type annotations
  object[attr] = function (instance: InternalInstance) {
    return fn.call(this, old, arguments);
  };
  return old;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does decorate() do?
decorate() is a function in the react codebase, defined in packages/react-devtools-shared/src/backend/legacy/utils.js.
Where is decorate() defined?
decorate() is defined in packages/react-devtools-shared/src/backend/legacy/utils.js at line 12.
What calls decorate()?
decorate() is called by 1 function(s): decorateMany.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free