Compare Two Lists
Write the code, see it run, pass the checks.
The problem
- medium
- Code
The Compare component gets two props, before and after, each a list of names (the preview's before is Ada, Ben, Cleo and Dev; its after is Ben, Dev, Eve, Ada and Finn). Show three lists with the accessible names "Added", "Removed" and "Kept" (for example aria-label, or aria-labelledby pointing at a heading). Added holds the names only in after, in after's order; Removed the names only in before, in before's order; Kept the names in both, in before's order. An empty group may show an empty list or no list at all. Below them, show a line like "2 added, 1 removed, 3 kept". Work it all out from the props.
Your code must pass
- Added lists the new names in after's order
- Removed lists the missing names in before's order
- Kept lists the names in both, in before's order
- The summary follows the props