You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Reassigning a local variable in an async function is *always* mutating
10
+
// after render, so this should error regardless of where this ends up
11
+
// getting called
12
+
value = result;
13
+
});
14
+
};
15
+
16
+
constonClick=async () => {
17
+
awaitreassign();
18
+
};
19
+
return<div onClick={onClick}>Click</div>;
20
+
}
21
+
22
+
```
23
+
24
+
25
+
## Error
26
+
27
+
```
28
+
6 | // after render, so this should error regardless of where this ends up
29
+
7 | // getting called
30
+
> 8 | value = result;
31
+
| ^^^^^ InvalidReact: Reassigning a variable in an async function can cause inconsistent behavior on subsequent renders. Consider using state instead. Variable `value` cannot be reassigned after render (8:8)
Copy file name to clipboardExpand all lines: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo.invalid-reassign-local-variable-in-async-callback.expect.md
0 commit comments