Change the price, add a coupon, or adjust quantity - everything updates automatically! No manual calculations needed.
This is like a real online shopping cart! When you shop on Amazon, changing one thing (like quantity) automatically updates:
๐ฏ Try it: Move any slider below and watch all the prices update instantly! SignalForge automatically knows what needs to recalculate.
Imagine coding this manually - you'd need to write code to recalculate everything whenever anything changes!
๐ You change the quantity
โ๏ธ You manually recalculate subtotal
โ๏ธ You manually recalculate discount
โ๏ธ You manually recalculate shipping
โ๏ธ You manually recalculate tax
โ๏ธ You manually recalculate total
๐ซ For 12 calculations: ~200 lines of code!
It's like doing your taxes by hand with a calculator! ๐งโ๐ป
๐ You change the quantity
โจ Everything updates automatically!
SignalForge tracks what depends on what, and only recalculates what changed.
const subtotal = createComputed(() => price.get() * quantity.get() ); // Done! Subtotal auto-updates! ๐
๐ For 12 calculations: ~50 lines of code!
Like having a personal accountant! ๐งพ
const price = createSignal(100); // Base price const quantity = createSignal(1); // How many items const discount = createSignal(10); // Discount %
These are like the input fields in a form! ๐
const subtotal = createComputed(() => price.get() * quantity.get() ); const total = createComputed(() => subtotal.get() - (subtotal.get() * discount.get() / 100) );
These auto-update when inputs change! No manual work! โจ
function Cart() {
const totalValue = useSignalValue(total);
return <div>Total: ${totalValue}</div>;
// Updates automatically when anything changes! ๐
}SignalForge handles all the math - you just display it! ๐
Base Price ร Quantity
$100.00
Level 1: subtotal
- Discount (0%)
-$0.00
Level 1: discountAmount
After Discount
$100.00
Level 1: afterDiscount
+ Shipping
$5.00
Level 2: shippingCost
+ Tax (10%)
$10.50
Level 4: taxAmount
Final Total
$115.50
Level 5: finalTotal
Level 0: Base Inputs
Level 1: Basic Calculations
Level 2: Shipping Logic
Level 3: Coupon Logic
Level 4: Tax Calculation
Level 5: Final Result
// Define once, works everywhere const subtotal = createComputed(() => basePrice.get() * quantity.get() ); const discountAmount = createComputed(() => subtotal.get() * (discount.get() / 100) ); const afterDiscount = createComputed(() => subtotal.get() - discountAmount.get() ); // ... 9 more like this // Total: ~50 lines including all logic
// Need reselect for memoization
import { createSelector } from 'reselect';
// Selector for each value
const selectBase = state => state.basePrice;
const selectQty = state => state.quantity;
// Memoized selector
const selectSubtotal = createSelector(
[selectBase, selectQty],
(base, qty) => base * qty
);
const selectDiscount = state => state.discount;
const selectDiscountAmount = createSelector(
[selectSubtotal, selectDiscount],
(sub, discount) => sub * (discount / 100)
);
// ... 50 more lines of selectors
// ... plus actions, reducers, types
// Total: ~200 lines for same logicLoan payments, investment returns, tax calculations with 20+ interdependent formulas. SignalForge handles the entire dependency tree automatically.
Character stats โ equipment bonuses โ skill modifiers โ final damage. Change one item, everything updates instantly.
Raw data โ filtered data โ aggregations โ visualizations. Filter changes propagate through entire pipeline in microseconds.
Volume discounts, member tiers, dynamic fees, currency conversion. This demo is a simplified real e-commerce scenario!