mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add test for function property mutation
There were no previous test paths that tested it, so I'm adding the example from https://github.com/facebookexternal/forget-feedback/issues/32 as a fixture
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
export function ViewModeSelector(props) {
|
||||
const renderIcon = () => <AcceptIcon />;
|
||||
renderIcon.displayName = "AcceptIcon";
|
||||
|
||||
return <Dropdown checkableIndicator={{ children: renderIcon }} />;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] InvalidReact: This mutates a global or a variable after it was passed to React, which means that React cannot observe changes to it. (3:3)
|
||||
```
|
||||
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export function ViewModeSelector(props) {
|
||||
const renderIcon = () => <AcceptIcon />;
|
||||
renderIcon.displayName = "AcceptIcon";
|
||||
|
||||
return <Dropdown checkableIndicator={{ children: renderIcon }} />;
|
||||
}
|
||||
Reference in New Issue
Block a user