import type { Document } from "@lib/types" import DocumentComponent from "@components/document" import { ChangeEvent, memo, useCallback } from "react" const DocumentList = ({ docs, removeDoc, updateDocContent, updateDocTitle }: { docs: Document[], updateDocTitle: (i: number) => (title: string) => void updateDocContent: (i: number) => (content: string) => void removeDoc: (i: number) => () => void }) => { const handleOnChange = useCallback((i) => (e: ChangeEvent) => { updateDocContent(i)(e.target.value) }, [updateDocContent]) return (<>{ docs.map(({ content, id, title }, i) => { return ( ) }) } ) } export default memo(DocumentList)