Skip to content

Commit

Permalink
[Fresh] Generate signatures for Hooks (facebook#15733)
Browse files Browse the repository at this point in the history
* Generate signatures for Hooks

This currently only works one level deep. For custom Hooks, we'll need to add some way to compose signatures.

* Be more resilient to plugin conflicts

This prevents a class of problems where other plugins cause our visitor to re-run.

It's a standard Babel practice, e.g.:

https://github.com/babel/babel/blob/8c7d4b55c99ff34cb9d493d452472e59b5ed1e70/packages/babel-plugin-transform-react-constant-elements/src/index.js#L85-L86

* Remove unnecessary stuff from debugging

* Include Foo.useHookName() calls into the signature

* Add an integration test for adding/removing an effect

* Add integration test for changing custom Hook order

* Include custom Hooks into the signatures

* Fix inferred names for function expressions

* Support export default hoc(Foo) when Foo is defined separately

* Add more built-in Hooks
  • Loading branch information
gaearon authored May 29, 2019
1 parent b74fa98 commit 556cc6f
Show file tree
Hide file tree
Showing 6 changed files with 1,057 additions and 69 deletions.
Loading

0 comments on commit 556cc6f

Please sign in to comment.