🌐 API + Computed Fields
Fetch tax rate from API, then auto-calculate with computed fields
📍 Step 1: Location (API Call)
Type 5 digits and press Enter or click away
📍 ,
Tax Rate: 0% (from API)
🛒 Step 2: Order (User Input)
🧮 Step 3: Auto-Calculated (Computed Fields)
These values update automatically using the API tax rate:
Subtotal (price × quantity)
$100
Tax (subtotal × API rate)
$0
Total
$0
📐 The Flow
1️⃣ User enters ZIP → Lifecycle hook triggers
2️⃣ API called → Returns tax rate + location
3️⃣ Data stored in context.location.taxRate
4️⃣ Computed fields detect dependency change
5️⃣ Tax & Total recalculate automatically!