Unlocking the structure of your React applications with the AST
summary
Claim: React components are effectively pure functions of props and state so build‑time AST transforms can add real tooling. Implementation uses Esprima to parse and escodegen/estraverse/esquery to rewrite code, producing a webpack loader that wraps React.createElement calls. Demo runs on TodoMVC demo and shows a live prop‑diff panel and 3D component view. Props are cloned with JSON stringify/parse and published to an event emitter for visualization; the transform is for development use because of serialization and performance costs.
AI-written summary · about
chapters (23)
- 0:00Introduction
- 2:03Static analysis
- 2:43Why static analysis is difficult
- 4:20Why static analysis is easier
- 4:46Lowlevel transformations of code
- 5:31Highlevel transformations of code
- 6:33Instrumentation
- 7:43MVC
- 9:42Component wrappers
- 10:29Component wrapper implementation
- 11:15Generalizing the transform
- 12:05What is a compiler
- 12:52What is an AST
- 13:37Parse
- 14:00Terminal Step
- 14:24Using the AST
- 14:52Traversal and Query
- 15:35FragmentParse
- 16:02Templates
- 16:38Object literals
- 16:52Transformation
- 18:37Return component name
- 21:37Conclusions








