Skip to main content
K
Last modified: 4/Oct/2024

mergeRef

This function is used to combine more than one ref.

#Usage

import { useRef } from "react"; import { mergeRef } from "@kinsta/merge-ref"; const MyComponent = <HTMLInputElement>({}, forwardedRef) => { const ref = useRef<HTMLInputElement>(null) return <input ref={mergeRef<HTMLInputElement>(ref, forwardedRef)} /> }