mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-10 09:33:51 +00:00
Created helper function to convert mutable refs from useRef into element refs for the ref prop
This commit is contained in:
5
src/utils/helpers/components.ts
Normal file
5
src/utils/helpers/components.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { MutableRefObject, Ref } from 'react';
|
||||
|
||||
export const mutableRefToElementRef = <T>(ref: MutableRefObject<T | undefined>): Ref<T> => (el) => {
|
||||
ref.current = el ?? undefined; // eslint-disable-line no-param-reassign
|
||||
};
|
||||
Reference in New Issue
Block a user