import { createRef, useRef, useState } from 'react'; import Categories from '../components/Categories/Categories'; import Links from '../components/Links/Links'; import styles from '../styles/Home.module.scss'; import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() export default function Home({ categories, favorites }) { const [categoryActive, setCategoryActive] = useState(categories?.[0]?.id); const refCategoryActive = useRef(); const handleSelectCategory = (id) => { if (!refCategoryActive?.current) return; const { ref } = categories.find(c => c.id === id); ref?.current?.scrollIntoView({ block: 'end', behavior: 'smooth' }); } return (