[Fresh] Use function expression for custom Hook signature argument#15956
Merged
Conversation
|
No significant bundle size changes to report. Generated by 🚫 dangerJS |
aweary
approved these changes
Jun 22, 2019
gaearon
added a commit
to gaearon/react
that referenced
this pull request
Jun 24, 2019
rickhanlonii
pushed a commit
to rickhanlonii/react
that referenced
this pull request
Jun 25, 2019
facebook-github-bot
pushed a commit
to facebook/react-native
that referenced
this pull request
Oct 31, 2023
Summary:
Hermes supports arrows. I assume the only reason the transform wasn't dropped is due to the scary TODO.
Originally, the arrow transform was conditional like this:
```js
if (isNull || src.indexOf('=>') !== -1) {
extraPlugins.push(es2015ArrowFunctions);
}
```
I made it unconditional in facebook/metro@beb3d1a (D15947985) to work around an issue where React Refresh Babel plugin emitted arrow functions. However, I fixed that plugin to _not_ emit arrow functions a long time ago in facebook/react#15956. So this TODO is effectively solved, and has been, for ages.
In this commit, we:
- Skip the transform for Hermes altogether
- For non-Hermes, revert to the old conditional behavior
Possible alternatives:
- We could skip it for Hermes but apply unconditionally otherwise (a bit simpler)
- Or, if all target non-Hermes runtimes already support it natively, we could completely remove it
## Changelog:
[GENERAL] [CHANGED] - Apply Babel arrow transform only on non-Hermes
Pull Request resolved: #41253
Test Plan: Run fbsource tests (that's for you, not for me :)
Reviewed By: NickGerleman
Differential Revision: D50818568
Pulled By: robhogan
fbshipit-source-id: ad96540bb7778792d38a6ddec06999d2acf620d0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needed internally, see D15947985.
We can later change that back but for now I'd like to not have to worry about this.