# Function useImperativeHandle

- useImperativeHandle<T, R>(ref, init, deps?): void

- `useImperativeHandle` customizes the instance value that is exposed to parent components when using `ref`. As always, imperative code using refs should be avoided in most cases.

  `useImperativeHandle` should be used with `React.forwardRef`.

  #### Type Parameters

  - T
  - R

  #### Parameters

  - ref: Ref<T>
  - init: (() => R)
    - - (): R

      - #### Returns R

  - `Optional` deps: DependencyList

  #### Returns void

  #### Version

  16.8.0

  #### See

  https://react.dev/reference/react/useImperativeHandle

  - Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:2042