Menu
CoddyTech

Recap: Donation Logic

Part of the Fundamentals section of Coddy's Vue journey. Lesson 50 of 55.

challenge icon

Challenge

Easy

Create useDonations(initial) returning a count ref, a computed value worth three units per donation, and an add() action. Call it independently with 1 for books and 2 for tools. Display the computed values in #result and #tools. Buttons #book-add and #tool-add increment only their own donation group.

Try it yourself

<!doctype html><html><head><meta charset="UTF-8"><title>Vue practice</title></head><body><div id="app"></div><script type="module" src="./main.js"></script></body></html>

All lessons in Fundamentals