Open Dev-Dipesh opened 6 months ago
The code is actually correct. You can double check. Because the number totalPages is by is actually not a integer. This is JavaScript, not Java.
const totalPages = totalJobs / RESULTS_PER_PAGE;
In Java, we would use the following expression.
int totalPages = (totalJobs + RESULTS_PER_PAGE - 1) / RESULTS_PER_PAGE;
Project: rmtdev Video Number: 158 Video Title: Finish Pagination (Derived State)
ISSUE: In the video, we're calculating the total pages without using
Math.ceil()
.FIX: Math.ceil is important here because we want to round up to the nearest whole number. For example, if we have 15 jobs and we want to display 7 jobs per page, we need 3 pages.