E0147 Export from a page's script
Why
The router runs a page's script once for each screen of it that it shows, so there is no single value to export.
How to fix it
Share state between screens with state(initial, { shared: "name" }).
In a terminal
duolith explain E0147
Mentioned in
- Navigation: routes, layouts and the screen stack
- Script declarations and components (Specification v0 draft)
- 0031. Routes come from file names, layouts wrap folders, and an app is a stack of screens
- 0033. A screen guards itself with guard(...), and screens share state by name
- 0067. Editions, and duolith upgrade moves a project to one with migrations
- 0152. Behaviours: script written once and used from any file's script