Open nguyenhoaikhang37 opened 11 months ago
Result: ✅
Overall good migration & form implementation 👍 Some nitpicks:
There's something buggy here. First time I logged in, I wasn't redirected. It worked on the second time, though 🤔
Current implementation assumes that by going back once, you're back to homepage. This might hold true for this project, but it's not a good practice to build a component with assumptions. It reduces the flexibility of the component.
By moving the logic out, we leave the responsibility to the parent components:
<DeleteBookDialog
...
onDelete={() => {
deleteBook();
push('/');
})
/>
Now you can use DeleteBookDialog
everywhere & be able to control the navigation. Or you can keep the deleteBook
call inside, and use an onAfterDelete
props to handle what happens after:
<DeleteBookDialog
...
onAfterDelete={() => {
push('/');
})
/>
You can keep these in the same place as the pagination component. E.g:
src/components/common/pagination
pagination.tsx
pagination.css
...
useMemo
will run every renders, because handleLogin
and handleLogout
are not memoized:Some points:
eslint-plugin-react-hooks
provide the rule?)useCallback
to memoize them
/ Demo link https://df-frontend-2023-njoi.vercel.app
// Any notes for reviewers If the code lacks clarify or if there are any issue with the application, please don't hesitate to provide feedback. I'm open to suggestions and eager to improve. Thanks a lot <3