Overview
Explore the power of Abstract Syntax Trees (AST) in React applications through this 28-minute conference talk from React.js Conf 2015. Delve into the concept of "code as data" and discover how Esprima, a JavaScript parser, enables access to AST representations. Learn about static analysis, code transformations, and instrumentation in React. Understand the basics of compilers, AST parsing, and traversal techniques. Gain insights into component wrappers, object literals, and practical implementations for unlocking the structure of React applications. Presented by Gurdas Nijor, Senior Software Engineer at OpenGov Inc, this talk demonstrates how leveraging AST can lead to innovative applications beyond traditional character-based code interpretation.
Syllabus
Introduction
Static analysis
Why static analysis is difficult
Why static analysis is easier
Lowlevel transformations of code
Highlevel transformations of code
Instrumentation
MVC
Component wrappers
Component wrapper implementation
Generalizing the transform
What is a compiler
What is an AST
Parse
Terminal Step
Using the AST
Traversal and Query
FragmentParse
Templates
Object literals
Transformation
Return component name
Conclusions
Taught by
Meta Developers