Coming from React: the typical mistakes and what Luxel says
Generated by scripts/gen-guide-reference.mjs from the corpus in packages/compiler/test/react (checked by packages/compiler/test/react-mistakes.test.ts). Each entry is real compiler output: the code, where it points, why Luxel does not work that way, and what to write instead. The full catalog of codes is DIAGNOSTICS.md.
The short version: a view runs once, at build time, in Node. It describes a page; it never runs in the browser. Data, state, rules, totals, formats and navigation are the server's (defineLoad, defineEvent); the view binds them with bind="…" and sends events with ‹Action event="…">.
| # | Habit from React | Code | Rule |
|---|---|---|---|
| 1 | a counter in component state | LUXEL-E003 | no-hooks |
| 2 | useEffect to load data after mount | LUXEL-E003 | no-hooks |
| 3 | onClick that updates state | LUXEL-E001 | no-function-handler |
| 4 | a controlled input with onChange | LUXEL-E001 | no-function-handler |
| 5 | a line total computed in JSX (qty × price) | LUXEL-E016 | item-field-misuse |
| 6 | fetch the data inside the component | LUXEL-E052 | data-fetching-in-view |
| 7 | map with logic (render only the active items) | LUXEL-E016 | item-field-misuse |
| 8 | an inline style object | LUXEL-E010 | unknown-prop |
| 9 | a link whose href is built from the item | LUXEL-E016 | item-field-misuse |
| 10 | a className chosen from the item's data | LUXEL-E028 | dynamic-attribute |
| 11 | import React | LUXEL-E002 | no-react-import |
| 12 | a plain ‹button> element | LUXEL-E004 | unknown-component |
| 13 | key on the mapped child instead of itemKey | LUXEL-E008 | collection-without-key |
| 14 | dangerouslySetInnerHTML for formatted text | LUXEL-E010 | unknown-prop |
| 15 | read the session in the component (next-auth) | LUXEL-E003 | no-hooks |
| 16 | navigate with useRouter (Next.js) | LUXEL-E003 | no-hooks |
| 17 | an async server component that awaits its data | LUXEL-E025 | async-component |
| 18 | today's date computed in the component | LUXEL-E026 | non-deterministic-view |
| 19 | money formatted in JSX (cents / 100, toFixed) | LUXEL-E016 | item-field-misuse |