refactor(client): convert ClearConvos component from jsx to tsx

refactor(client): convert Dialog, DialogButton, Input, Label, Checkbox, and DialogTemplate components from jsx to tsx
refactor(client): export ClearChatsButton component from General.tsx
refactor(client): add useCallback hook to moveToTop function in Nav component
This commit is contained in:
Daniel Avila 2023-06-11 14:46:21 -04:00 committed by Danny Avila
parent c661276888
commit 931a89204c
6 changed files with 50 additions and 53 deletions

View file

@ -1,5 +1,5 @@
/* eslint-disable react-hooks/exhaustive-deps */
import { useState, useEffect, useRef, useContext } from 'react';
import { useState, useEffect, useRef, useContext, useCallback } from 'react';
import NewChat from './NewChat';
import Panel from '../svg/Panel';
import Spinner from '../svg/Spinner';
@ -100,12 +100,12 @@ export default function Nav({ navVisible, setNavVisible }) {
}
};
const moveToTop = () => {
const moveToTop = useCallback(() => {
const container = containerRef.current;
if (container) {
scrollPositionRef.current = container.scrollTop;
}
};
}, [containerRef, scrollPositionRef]);
const nextPage = async () => {
moveToTop();