Open nghianm2803 opened 1 year ago
Hi @nghianm2803 , solid work!
Final result: ✅ passed
You can develop a reusable component for the modal and specify its usage for various purposes (such as adding, editing, or creating) instead of duplicating the code for each specific case (AddBook, EditBook, DeleteBook).
It seems you forgot to type these variables https://github.com/nghianm2803/df-frontend-2023/blob/874ba1b4b90d12279732f0859c85399d2e2bf522/assignment-3/src/components/TableBook.tsx#L26-L28
const [bookToEdit, setBookToEdit] = useState<IBook | null>(null)
const [deleteModal, setDeleteModal] = useState<boolean>(false)
const [bookToDelete, setBookToDelete] = useState<IBook | null>(null)
TypeScript automatically infers the type of variables from their initial values, so there's no need to explicitly redefine it https://github.com/nghianm2803/df-frontend-2023/blob/874ba1b4b90d12279732f0859c85399d2e2bf522/assignment-3/src/components/TableBook.tsx#L29 https://github.com/nghianm2803/df-frontend-2023/blob/874ba1b4b90d12279732f0859c85399d2e2bf522/assignment-3/src/layouts/MainBody.tsx#L16-L17 ...
const [isLoading, setIsLoading] = useState(true)
@chinhld12 Thanks for your detailed feedback. I'll do better in the next assignments.
Demo link: https://df-frontend-2023-nghianm-assignment3.vercel.app/ Features done:
Additional note: I created enough books for mentors to quickly test Pagination. Validation Add/Edit form. Store books, current page, and theme in LocalStorage. Empty state for a good user experience.