dillon1000/react

Commit

Enable hook syntax support

Updates the compiler to understand Flow hook syntax. Like component syntax, in 
infer mode hooks are compiled by default unless opted out. 

Looking ahead, i can imagine splitting up our compilation modes as follows: 

* Annotations: opt-in explicitly 

* Declarations: annotations + component/hook declarations 

* Infer: annotations, component/hook declarations, + component/hook-like 
functions 

This also suggest an alternative annotation strategy: "use react" (or "use 
component" / "use hook") as a general way to tell the compiler that a function 
is intended for React. Then opting out of memoization could do "use 
react(nomemo)".
Browse files
Changed paths8 files
First-parent comparison
M compiler/packages/babel-plugin-react-forget/package.json ModifiedM compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts ModifiedA compiler/packages/babel-plugin-react-forget/src/Utils/HookDeclaration.ts AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-declaration-basic.flow.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/hook-declaration-basic.flow.js AddedM compiler/packages/eslint-plugin-react-compiler/package.json ModifiedM compiler/packages/sprout/src/SproutTodoFilter.ts ModifiedM compiler/yarn.lock Modified
Patch

Files changed

Rendering syntax-highlighted changes…