Premium
React Filterable / Searchable User List
Filter a React user list by search text and role. Derive filtered results without mutating the source array, and show an empty state when no matches exist. Add performance notes (memoization or debouncing), accessibility for filter controls, and tests for empty/error states and large datasets.…
- Render a filter UI and a list of users as the main…
- Use a fixed in-memory list of users (name, role, active flag).
What you’ll build / What this tests
This premium react coding focuses on React Filterable / Searchable User List. You’ll apply react and state thinking with intermediate level constraints. The prompt emphasizes Filter a React user list by search text and role. Derive filtered results without mutating the….
Learning goals
- Translate the prompt into a clear react API signature and return shape.
- Apply react, state, lists techniques to implement react filterable / searchable user list.
- 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 filter UI and a list of users as the main UI.
- Use a fixed in-memory list of users (name, role, active flag).
- Provide a text input that filters by name (case-insensitive).
- Provide a role dropdown (All, Admin, Editor, Viewer) that filters by role.
- Provide a checkbox that, when checked, shows only active users.
- Render the filtered list below the controls.
- Initially, all users are shown.
- Typing in the search box filters users whose name includes the search text (case-insensitive).
- Changing the role dropdown filters by that role (or shows all roles when "All" is selected).
- Checking the "Only active users" checkbox hides inactive users.
Mini snippet (usage only)
// Example usage
const input = /* react filterable / searchable user list 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.