react/compiler
mofeiZ a9575dcf62
[compiler] Represent array accesses with PropertyLoad (#32287)
Prior to this PR, our HIR represented property access with numeric
literals (e.g. `myVar[0]`) as ComputedLoads. This means that they were
subject to some deopts (most notably, not being easily dedupable /
hoistable as dependencies).

Now, `PropertyLoad`, `PropertyStore`, etc reference numeric and string
literals (although not yet string literals that aren't valid babel
identifiers). The difference between PropertyLoad and ComputedLoad is
fuzzy now (maybe we should rename these).
- PropertyLoad: property keys are string and numeric literals, only when
the string literals are valid babel identifiers
- ComputedLoad: non-valid babel identifier string literals (rare) and
other non-literal expressions

The biggest feature from this PR is that it trivially enables
array-indicing expressions as dependencies. The compiler can also
specify global and imported types for arrays (e.g. return value of
`useState`)


I'm happy to close this if it complicates more than it helps --
alternative options are to entirely rely on instruction reordering-based
approaches like ReactiveGraphIR or make dependency-specific parsing +
hoisting logic more robust.
2025-02-18 11:54:20 -07:00
..
apps/playground [compiler] Playground qol: shared compilation option directives with tests (#32012) 2025-01-09 12:38:16 -05:00
docs [compiler][be] Remove unused experimental Rust port 2025-01-24 12:23:31 -08:00
fixtures [cleanup] Remove compiler runtime-compat fixture library (#31430) 2024-11-05 14:14:39 -05:00
packages [compiler] Represent array accesses with PropertyLoad (#32287) 2025-02-18 11:54:20 -07:00
scripts [compiler] Switch to esbuild (#31963) 2025-01-02 16:59:56 -05:00
.eslintrc.js [compiler:codegen] Wrap non-ascii characters in JsxExpressionContainer 2024-06-21 10:08:15 -04:00
.gitignore [.gitignore] Add bundle script 2024-04-16 14:41:13 +01:00
package.json [compiler] Upgrade esbuild (#32368) 2025-02-12 11:59:56 -05:00
README.md Update readme and other docs 2024-05-06 14:53:47 -07:00
yarn.lock [compiler] Upgrade esbuild (#32368) 2025-02-12 11:59:56 -05:00

React Compiler

React Compiler is a compiler that optimizes React applications, ensuring that only the minimal parts of components and hooks will re-render when state changes. The compiler also validates that components and hooks follow the Rules of React.

More information about the design and architecture of the compiler are covered in the Design Goals.

More information about developing the compiler itself is covered in the Development Guide.