From 0f18c0be9eeb6426230ad4b846c870a3a99d4d26 Mon Sep 17 00:00:00 2001 From: keannu125 Date: Sat, 4 Mar 2023 17:21:00 +0800 Subject: [PATCH] Made note mapping use a common interface --- src/Components/Notes/Notes.tsx | 37 ++++++++++++---------------------- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/src/Components/Notes/Notes.tsx b/src/Components/Notes/Notes.tsx index f8e0eda..cee1589 100644 --- a/src/Components/Notes/Notes.tsx +++ b/src/Components/Notes/Notes.tsx @@ -6,7 +6,7 @@ import { Button } from "@mui/material"; import { useQuery } from "react-query"; import { GetNotes } from "../Api/Api"; import { useSelector } from "react-redux"; -import { LoginState } from "../../Interfaces/Interfaces"; +import { LoginState, NoteProps } from "../../Interfaces/Interfaces"; export default function Notes() { const navigate = useNavigate(); @@ -55,29 +55,18 @@ export default function Notes() { return ( <> - {notes.map( - ( - note: { - owner: string; - title: string; - content: string; - id: number; - date_created: Date; - }, - index: number - ) => { - return ( - - ); - } - )} + {notes.map((note: NoteProps, index: number) => { + return ( + + ); + })}