Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the React
useEffect
hook (#5608)
* Add support for the React `useEffect` hook * Format * Format * [Refactor] remove unnecessary condition `canHaveTrailingComma` is defined as `I(lastElem && ...)`, which will always be true when `lastElem === null`. * Use a hacky method to allow the array to break * Revert "[Refactor] remove unnecessary condition" This reverts commit 91906ba. * Add tests for `React.useEffect` form
- Loading branch information
Showing
3 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function helloWorld() { | ||
useEffect(() => { | ||
// do something | ||
}, [props.value]) | ||
useEffect(() => { | ||
// do something | ||
}, [props.value, props.value, props.value, props.value, props.value, props.value, props.value, props.value, props.value, props.value, props.value]) | ||
} | ||
|
||
function helloWorldWithReact() { | ||
React.useEffect(() => { | ||
// do something | ||
}, [props.value]) | ||
React.useEffect(() => { | ||
// do something | ||
}, [props.value, props.value, props.value, props.value, props.value, props.value, props.value, props.value, props.value, props.value, props.value]) | ||
} | ||
|