Premium
React Paginated Data Table
Build a simple paginated data table in React that shows a static list of users. Display 5 rows per page, with Previous / Next controls and a "Page X of Y" indicator. Disable the navigation buttons appropriately on the first and last pages. React focus:…
- Render a main component that shows a table of users.
- Use a static list (around 20 users) with id, name, email, and…
What you’ll build / What this tests
This premium react coding focuses on React Paginated Data Table. You’ll apply react and state thinking with intermediate level constraints. The prompt emphasizes Build a simple paginated data table in React that shows a static list of users. Display….
Learning goals
- Translate the prompt into a clear react API signature and return shape.
- Apply react, state, pagination techniques to implement react paginated data table.
- Handle intermediate edge cases without sacrificing readability.
- Reason about time/space complexity and trade-offs in react.
Key decisions to discuss
- Define the exact input/output contract before coding.
- Choose iteration vs higher-order methods for readability.
- Prioritize predictable edge-case handling over micro-optimizations.
Evaluation rubric
- Correctness: covers required behaviors and edge cases.
- Clarity: readable structure and predictable control flow.
- Complexity: avoids unnecessary work for large inputs.
- API discipline: no mutation of inputs; returns expected shape.
- Testability: solution is easy to unit test.
Constraints / Requirements
- Render a main component that shows a table of users.
- Use a static list (around 20 users) with id, name, email, and role.
- Show 5 rows per page.
- Add "Previous" and "Next" buttons to change the current page.
- Display the current page and total pages (for example "Page 2 of 4").
- Disable "Previous" on the first page and "Next" on the last page.
- Initial render shows the first 5 users (page 1).
- Clicking "Next" advances by 5 users until the last page.
- Clicking "Previous" moves back by 5 users until the first page.
- On the first page, "Previous" is disabled and does nothing when clicked.
Mini snippet (usage only)
// Example usage
const input = /* react paginated data table input */;
const result = solve(input);
console.log(result);
// Edge case check
const empty = input ?? null;
const fallback = solve(input);
console.log(fallback);
// Expected: describe output shape, not the implementation
// (no solution code in preview)Common pitfalls
- Mutating inputs instead of returning a new value.
- Skipping edge cases like empty input, duplicates, or nulls.
- Overlooking time complexity for large inputs.
Related questions
Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.