X05

Error

State and reactivity

X05 — use of a store nothing declares

use names a store the page depends on; one that is not declared is a misspelling, and every read of it is nothing.

What the compiler said

error[X05]: `use Carts` names a store nothing declares --> src/App.wf:3:5 | 3 | use Carts | ^^^ = help: The stores are `Cart` = docs: https://webfluent.monzeromer.dev/errors/X05

Your editor offers this fix: Change to Cart. wf fix --code X05 applies it to every place it fits.

The fix

Broken

wf

store Cart { state items: [String] = [] } page P(path: "/", title: "T", description: "D") { use Carts Heading("Cart").h1 }

Fixed

wf

store Cart { state items: [String] = [] } page P(path: "/", title: "T", description: "D") { use Cart Heading("Cart: {Cart.items.length}").h1 }

Name a store that exists — here Cart.

Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).

lints cannot lower it: it would ship a broken page.