LuxelEspañol

Luxel v0.2 · Reference · part 1 of 3

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 ReactCodeRule
1a counter in component stateLUXEL-E003no-hooks
2useEffect to load data after mountLUXEL-E003no-hooks
3onClick that updates stateLUXEL-E001no-function-handler
4a controlled input with onChangeLUXEL-E001no-function-handler
5a line total computed in JSX (qty × price)LUXEL-E016item-field-misuse
6fetch the data inside the componentLUXEL-E052data-fetching-in-view
7map with logic (render only the active items)LUXEL-E016item-field-misuse
8an inline style objectLUXEL-E010unknown-prop
9a link whose href is built from the itemLUXEL-E016item-field-misuse
10a className chosen from the item's dataLUXEL-E028dynamic-attribute
11import ReactLUXEL-E002no-react-import
12a plain ‹button> elementLUXEL-E004unknown-component
13key on the mapped child instead of itemKeyLUXEL-E008collection-without-key
14dangerouslySetInnerHTML for formatted textLUXEL-E010unknown-prop
15read the session in the component (next-auth)LUXEL-E003no-hooks
16navigate with useRouter (Next.js)LUXEL-E003no-hooks
17an async server component that awaits its dataLUXEL-E025async-component
18today's date computed in the componentLUXEL-E026non-deterministic-view
19money formatted in JSX (cents / 100, toFixed)LUXEL-E016item-field-misuse
Edit this page on GitHub

This page: 7.9 KB of JavaScript (Luxel's shared runtime), 0 KB from your app.

Measured when the site is built: the runtime files this page loads, compressed as they are sent.

Made by IntiOps. The Luxel 0.1.0 betas are on npm (0.1.0-beta.1, 0.1.0-beta.2), with an alpha of 0.2 (0.2.0-alpha.1): no external security review yet.