mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Repro for "expect trees to be >=2 elements long" invariant
These cases have a switch with only a default, so we create a "conditional" child dependency tree and no other trees which hits the invariant.
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
function Component({ kind, ...props }) {
|
||||
switch (kind) {
|
||||
default:
|
||||
return <Stringify {...props} />;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] Invariant: Expected trees to be at least 2 elements long.
|
||||
```
|
||||
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
function Component({ kind, ...props }) {
|
||||
switch (kind) {
|
||||
default:
|
||||
return <Stringify {...props} />;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user