Fixed Type Errors and Replaced Most Cases of ElementRef with Modern Alternitives

This commit is contained in:
Ahmad 2024-05-29 17:59:57 -04:00
parent b44c2e0f6e
commit e29f7bf253
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
11 changed files with 45 additions and 1958 deletions

View file

@ -2,7 +2,7 @@
import { useEventListener, useOnClickOutside } from 'usehooks-ts';
import { useQueryClient } from '@tanstack/react-query';
import { useState, ElementRef, useRef } from 'react';
import { useState, useRef } from 'react';
import { useParams } from 'next/navigation';
import { AlignLeft } from 'lucide-react';
import { toast } from 'sonner';
@ -26,8 +26,8 @@ export const Description = ({ data }: DescriptionProps) => {
const [isEditing, setIsEditing] = useState(false);
const textareaRef = useRef<ElementRef<'textarea'>>(null);
const formRef = useRef<ElementRef<'form'>>(null);
const textareaRef = useRef<HTMLTextAreaElement>(null);
const formRef = useRef<HTMLFormElement>(document.createElement('form'));
const enaleEditing = () => {
setIsEditing(true);

View file

@ -1,6 +1,6 @@
'use client';
import { useRef, ElementRef, useState } from 'react';
import { useRef, useState } from 'react';
import { useQueryClient } from '@tanstack/react-query';
import { useParams } from 'next/navigation';
import { Layout } from 'lucide-react';
@ -38,7 +38,7 @@ export const Header = ({ data }: HeaderProps) => {
},
});
const inputRef = useRef<ElementRef<'input'>>(null);
const inputRef = useRef<HTMLInputElement>(null);
const [title, setTitle] = useState(data.title);