mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Test case for Array.push on frozen array
Just making sure that we reject this
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
function Component(props) {
|
||||
const x = [];
|
||||
<div>{x}</div>;
|
||||
x.push(props.value);
|
||||
return x;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidInput: InferReferenceEffects: inferred mutation of known immutable value. Found mutation of $20:TObject<BuiltInArray> (frozen) (4:4)
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
function Component(props) {
|
||||
const x = [];
|
||||
<div>{x}</div>;
|
||||
x.push(props.value);
|
||||
return x;
|
||||
}
|
||||
Reference in New Issue
Block a user