Skip to content

Commit

Permalink
[core] Document a bit useLazyRef
Browse files Browse the repository at this point in the history
A follow-up on #9712 (comment).
  • Loading branch information
oliviertassinari committed Aug 20, 2023
1 parent 63df29a commit b9018a4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/grid/x-data-grid/src/hooks/utils/useLazyRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';

const UNINITIALIZED = {};

// See https://github.com/facebook/react/issues/14490 for when to use this.
export function useLazyRef<T, U>(init: (arg?: U) => T, initArg?: U) {
const ref = React.useRef(UNINITIALIZED as unknown as T);

Expand Down

0 comments on commit b9018a4

Please sign in to comment.