/** * A very simple interface, but a good marker of intent */ export interface UnrenderedValue { value: T; } /** * useUnrenderedValue is meant to wrap a value in a container that will _always_ be reference equal. * This can be very useful for constructing callbacks or imperative functions that use these values but explicitly * do _not_ use these values to render content. This is important because new references are required for React * to render at the correct times. * * For example, in this case `payload` is never rendered, but used as a callback. * We don't want to rerender `ExpensiveComponent` whenever this payload changes, * but we do want it to use the current value when its callback is called. * ```tsx * const PerformantComponent = ({ payload }: Props) => { * const unrenderedPayload = useUnrenderedValue(payload); * const do = React.useCallback(() => unrenderedPayload.value.do(), [unrenderedPayload]); * return ( * * ) * }; * ``` * * @see https://reactjs.org/docs/optimizing-performance.html#avoid-reconciliation which includes information * about optimizing for React performance but focuses more specifically on class components */ export declare function useUnrenderedValue(value: T): UnrenderedValue; //# sourceMappingURL=useUnrenderedValue.d.ts.map