-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not hoist jsx referencing a mutable binding (#10529)
- Loading branch information
1 parent
fbf3cb0
commit 3498195
Showing
5 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...m-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/input.mjs
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,10 @@ | ||
let foo = 'hello'; | ||
|
||
const mutate = () => { | ||
foo = 'goodbye'; | ||
} | ||
|
||
export const Component = () => { | ||
if (Math.random() > 0.5) mutate(); | ||
return <span>{foo}</span>; | ||
}; |
10 changes: 10 additions & 0 deletions
10
...-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/output.mjs
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,10 @@ | ||
let foo = 'hello'; | ||
|
||
const mutate = () => { | ||
foo = 'goodbye'; | ||
}; | ||
|
||
export const Component = () => { | ||
if (Math.random() > 0.5) mutate(); | ||
return <span>{foo}</span>; | ||
}; |
6 changes: 6 additions & 0 deletions
6
...transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/input.mjs
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,6 @@ | ||
let foo = 'hello'; | ||
|
||
export const Component = () => { | ||
foo = 'goodbye'; | ||
return <span>{foo}</span>; | ||
}; |
5 changes: 5 additions & 0 deletions
5
...ransform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/output.mjs
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,5 @@ | ||
let foo = 'hello'; | ||
export const Component = () => { | ||
foo = 'goodbye'; | ||
return <span>{foo}</span>; | ||
}; |
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