Home / Function/ getPooledWarningPropertyDefinition() — react Function Reference

getPooledWarningPropertyDefinition() — react Function Reference

Architecture documentation for the getPooledWarningPropertyDefinition() function in SyntheticEvent.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  dd069d6d_499a_9058_7e32_443dde641b45["getPooledWarningPropertyDefinition()"]
  a47c9419_7313_73d9_a24c_401cd8fd59b8["SyntheticEvent.js"]
  dd069d6d_499a_9058_7e32_443dde641b45 -->|defined in| a47c9419_7313_73d9_a24c_401cd8fd59b8
  style dd069d6d_499a_9058_7e32_443dde641b45 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-native-renderer/src/legacy-events/SyntheticEvent.js lines 261–298

function getPooledWarningPropertyDefinition(propName, getVal) {
  function set(val) {
    const action = isFunction ? 'setting the method' : 'setting the property';
    warn(action, 'This is effectively a no-op');
    return val;
  }

  function get() {
    const action = isFunction
      ? 'accessing the method'
      : 'accessing the property';
    const result = isFunction
      ? 'This is a no-op function'
      : 'This is set to null';
    warn(action, result);
    return getVal;
  }

  function warn(action, result) {
    if (__DEV__) {
      console.error(
        "This synthetic event is reused for performance reasons. If you're seeing this, " +
          "you're %s `%s` on a released/nullified synthetic event. %s. " +
          'If you must keep the original synthetic event around, use event.persist(). ' +
          'See https://react.dev/link/event-pooling for more information.',
        action,
        propName,
        result,
      );
    }
  }
  const isFunction = typeof getVal === 'function';
  return {
    configurable: true,
    set: set,
    get: get,
  };
}

Domain

Subdomains

Frequently Asked Questions

What does getPooledWarningPropertyDefinition() do?
getPooledWarningPropertyDefinition() is a function in the react codebase, defined in packages/react-native-renderer/src/legacy-events/SyntheticEvent.js.
Where is getPooledWarningPropertyDefinition() defined?
getPooledWarningPropertyDefinition() is defined in packages/react-native-renderer/src/legacy-events/SyntheticEvent.js at line 261.

Analyze Your Own Codebase

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

Try Supermodel Free