Created helper function to convert mutable refs from useRef into element refs for the ref prop

This commit is contained in:
Alejandro Celaya
2022-06-06 20:46:51 +02:00
parent b450e4093e
commit 7669254a0c
6 changed files with 18 additions and 21 deletions

View File

@@ -4,6 +4,7 @@ import { complement, pipe } from 'ramda';
import { faFileUpload as importIcon } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useToggle } from '../../utils/helpers/hooks';
import { mutableRefToElementRef } from '../../utils/helpers/components';
import { ServersImporter } from '../services/ServersImporter';
import { ServerData, ServersMap } from '../data';
import { DuplicatedServersModal } from './DuplicatedServersModal';
@@ -78,9 +79,7 @@ export const ImportServersBtn = ({ importServersFromFile }: ServersImporter): FC
type="file"
accept="text/csv"
className="import-servers-btn__csv-select"
ref={(el) => {
ref.current = el ?? undefined;
}}
ref={mutableRefToElementRef(ref)}
onChange={onFile}
/>