UNPKG

@ui-schema/react

Version:

Schema-driven UI generator for React using JSON Schema. Build powerful form and interface generators with headless components and hooks.

9 lines 293 B
import { isEqual } from '@ui-schema/ui-schema/Utils/isEqual'; import * as React from 'react'; export function useImmutable(value) { const currentState = React.useRef(value); if (!isEqual(currentState.current, value)) { currentState.current = value; } return currentState.current; }