Do not hoist jsx referencing a mutable binding (#10529)

This commit is contained in:
Nicolò Ribaudo
2019-10-08 18:50:03 +02:00
committed by GitHub
parent fbf3cb0ac4
commit 3498195ae2
5 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
let foo = 'hello';
const mutate = () => {
foo = 'goodbye';
}
export const Component = () => {
if (Math.random() > 0.5) mutate();
return <span>{foo}</span>;
};

View File

@@ -0,0 +1,10 @@
let foo = 'hello';
const mutate = () => {
foo = 'goodbye';
};
export const Component = () => {
if (Math.random() > 0.5) mutate();
return <span>{foo}</span>;
};

View File

@@ -0,0 +1,6 @@
let foo = 'hello';
export const Component = () => {
foo = 'goodbye';
return <span>{foo}</span>;
};

View File

@@ -0,0 +1,5 @@
let foo = 'hello';
export const Component = () => {
foo = 'goodbye';
return <span>{foo}</span>;
};