Page Through a Filtered List
Write the code, see it run, pass the checks.
The problem
- medium
- Code
- Pro
The Cities component gets a cities prop, a list of names (the preview uses 11: Amsterdam, Berlin, Bern, Cairo, Dublin, Lisbon, London, Madrid, Oslo, Paris and Rome). Add a text input labelled "Filter". Show the cities whose name contains the filter text (ignoring upper and lower case) 4 at a time, as list items, with "Previous" and "Next" buttons and a line like "Page 1 of 3". Previous is disabled on the first page and Next on the last. Changing the filter always goes back to page 1. When nothing matches, show "No cities match" and "Page 1 of 1", with both buttons disabled.
Your code must pass
- Shows 4 cities a page
- Filtering pages only the matching cities
- Changing the filter goes back to page 1
- Shows "No cities match" when nothing matches