Skip to content

Study Journal 06-08-2024

Published: at 12:00 AM

Where I’m at

What I learnt

Svelte Runes: To use $derived, or to not $derived.

TL;DR — Compute using functions, unless it’s big and scary then use $derived

Svelte Runes: Don’t use $effect, when you can use $derived instead.

Adapting our SOLID heuristic from yesterday:

When we’re building a Svelte 5 reactive component, think of the restaurant:

$state: The till

Checklist:

Example:



$derived: The kitchen display

Checklist:

Example:



$effect: The vampire staff

Checklist:

Example:

Remember! While vampires are great at night tasks, don’t ask them to operate the till, or cook during the day!


Props: Till to Kitchen Display Screen

Bindables: Uber Eats Tablet:

What I did

Consider supporting this blog