100 JS Functions

Beginner

1. CurrentYear

2. SimpleCounter

3. DoubleNumber

4. CreateColor

5. DynamicGrid

6. DynamicPictureSize

7. RandomButton

8. TabbedNavigation

9. MathOperator

10. GuessTheNumber

11. BetweenDates

12. Reactions

13. FeedTheBunny

14. Countdown

15. ClickFast

16. SkillsForJobs

17. UsersTabel

18. TodoList

19. UserSearch

20. SpendingInfo

20.SpendingInfo

Write a component named SpendingInfo that receives a list of purchases as a prop:

type Purchase = {
  id: string;
  day: string; // format: "YYYY-MM-DD"
  amount: number; // in USD
};

The component should group purchases by day and display the total amount spent per day in a list. Example output:

2020-05-15: 1250 USD
2020-06-01: 500 USD

If there are no purchases, display the message: No purchases found.

Example 1

Input

No input props

Demo

Open demo in new window

You'll see test results here!