Lesson 14 of 15
Project Feature: Interactive Filtering
Lesson Updated: Apr 28, 2026
Requirement
Expand the DevDash project by adding a search bar to filter the "Recent Activity" feed in real-time.
Assignments (Start First)
- State Setup: Open your DevDash project. In the parent component of the
RecentActivitylist, create a state variable forsearchQuery. - The Search Input: Build a
SearchBarcomponent and place it right above the activity feed. Pass down the state setter so the input updatessearchQuery. - Filtering the Data: Before mapping the activity data into your list, use
.filter()to only keep activities where the action text includes thesearchQuery(make sure to handle case-insensitivity using.toLowerCase()). - Handling Empty Results: If the user searches for something that doesn't exist, the filtered array will be empty. Display a friendly "No matching activity found" message instead of an empty space.
Lessons (Optional)
- Lifting State Up: If the search bar and the list are siblings, the state must live in their closest common parent so it can be passed down to both.
The Summary and Quizzes
- Feature Review: Adding interactive search requires a solid grasp of State, Props (passing the setter), and Array Methods (filtering).