Home / Function/ useFormatRelativeTime() — react Function Reference

useFormatRelativeTime() — react Function Reference

Architecture documentation for the useFormatRelativeTime() function in repro-destructure-from-prop-with-default-value.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  204eb2af_c479_536a_f680_aa879c25b2ea["useFormatRelativeTime()"]
  d6f2c1e0_0772_1a31_e2fd_25063c949206["repro-destructure-from-prop-with-default-value.js"]
  204eb2af_c479_536a_f680_aa879c25b2ea -->|defined in| d6f2c1e0_0772_1a31_e2fd_25063c949206
  style 204eb2af_c479_536a_f680_aa879c25b2ea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-destructure-from-prop-with-default-value.js lines 2–14

export function useFormatRelativeTime(opts = {}) {
  const {timeZone, minimal} = opts;
  const format = useCallback(function formatWithUnit() {}, [minimal]);
  // We previously recorded `{timeZone}` as capturing timeZone into the object,
  // then assumed that dateTimeFormat() mutates that object,
  // which in turn could mutate timeZone and the object it came from,
  // which meanteans that the value `minimal` is derived from can change.
  //
  // The fix was to record a Capture from a maybefrozen value as an ImmutableCapture
  // which doesn't propagate mutations
  dateTimeFormat({timeZone});
  return format;
}

Subdomains

Frequently Asked Questions

What does useFormatRelativeTime() do?
useFormatRelativeTime() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-destructure-from-prop-with-default-value.js.
Where is useFormatRelativeTime() defined?
useFormatRelativeTime() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-destructure-from-prop-with-default-value.js at line 2.

Analyze Your Own Codebase

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

Try Supermodel Free