[test] Add failing test for mutating global

This commit is contained in:
Sathya Gunasekaran committed 2023-07-05 20:21:05 +05:30
1 parent 6e6ecfc4d9
commit 8eca031508
2 files changed
+39

No files matched your search

@@ -0,0 +1,33 @@
## Input
```javascript
let renderCount = 0;
function NoHooks() {
renderCount++;
return <div />;
}
```
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
let renderCount = 0;
function NoHooks() {
const $ = useMemoCache(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = <div />;
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}
```
@@ -0,0 +1,6 @@
let renderCount = 0;
function NoHooks() {
renderCount++;
return <div />;
}