You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/MENTAL-MODEL.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,24 @@ Notice what's happening:
81
81
- Event timing knowledge (pointerdown fires before focus) — standard browser behavior
82
82
-**Instance-scoped state** — `wasFocused` is local to each component instance via closure
83
83
84
+
#### The Unlock: Component = Constructor
85
+
86
+
React's `UI = fn(state)` model means:
87
+
- Functions re-run constantly
88
+
- Closures capture stale values
89
+
- You need `useRef`, `useCallback`, `useMemo` to escape the re-render trap
90
+
- The framework fights the language
91
+
92
+
Azoth's model: **component = constructor**
93
+
- Runs once, returns DOM
94
+
- Closures just work
95
+
- Local variables are instance state
96
+
- JavaScript works like JavaScript
97
+
98
+
The "unlock" is realizing the platform (JS + DOM) was already good. React's abstractions were solving problems *it created*, not problems inherent to building UIs.
99
+
100
+
Once you stop thinking in `UI = fn(state)`, you unlock the platform: DOM + JS.
0 commit comments