Implement react-intersection-observer to facilitate infinite scroll

Uses react-intersection-observer to load more comments when the last of the previously loaded comments is in the viewport.
This commit is contained in:
Aaron William Po
2023-04-09 18:41:58 -04:00
parent 8981bcb4b8
commit 915adb722a
12 changed files with 157 additions and 109 deletions

View File

@@ -1,4 +1,4 @@
import useUser from '@/hooks/useUser';
import useUser from '@/hooks/useUser';
import GetUserSchema from '@/services/User/schema/GetUserSchema';
import { createContext } from 'react';
import { z } from 'zod';
@@ -7,7 +7,7 @@ const UserContext = createContext<{
user?: z.infer<typeof GetUserSchema>;
error?: unknown;
isLoading: boolean;
mutate?: ReturnType<typeof useUser>['mutate']
mutate?: ReturnType<typeof useUser>['mutate'];
}>({ isLoading: true });
export default UserContext;