Recap: Donation Logic
Part of the Fundamentals section of Coddy's Vue journey. Lesson 50 of 55.
Challenge
EasyCreate 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
7Reusable Components
Importing ComponentsIndependent InstancesPassing PropsProp Types and DefaultsRecap: Component Cards10Reusable Composables
Extracting Reactive LogicReturning Live RefsDerived Composable ValuesIndependent Composable CallsRecap: Donation Logic2Reactive State
Reactive RefsUpdating Refs in ScriptEvent Handler ArgumentsReactive ObjectsRecap: Reactive State5Conditions and Lists
Conditional BranchesShow without UnmountingRendering ListsStable List IdentityRecap: Conditions8Component Communication
Emitting EventsEvent PayloadsLifting Shared StateDefault and Named SlotsRecap: Shared Panel11Project: Community Board
Board StructureAdding Community Tasks