Do not hoist jsx referencing a mutable binding (#10529)
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
let foo = 'hello';
|
||||
|
||||
const mutate = () => {
|
||||
foo = 'goodbye';
|
||||
}
|
||||
|
||||
export const Component = () => {
|
||||
if (Math.random() > 0.5) mutate();
|
||||
return <span>{foo}</span>;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
let foo = 'hello';
|
||||
|
||||
const mutate = () => {
|
||||
foo = 'goodbye';
|
||||
};
|
||||
|
||||
export const Component = () => {
|
||||
if (Math.random() > 0.5) mutate();
|
||||
return <span>{foo}</span>;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
let foo = 'hello';
|
||||
|
||||
export const Component = () => {
|
||||
foo = 'goodbye';
|
||||
return <span>{foo}</span>;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
let foo = 'hello';
|
||||
export const Component = () => {
|
||||
foo = 'goodbye';
|
||||
return <span>{foo}</span>;
|
||||
};
|
||||
Reference in New Issue
Block a user